From 54560fc91ab5ad94997089f7cfb52818dda7df94 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Fri, 10 May 2024 13:13:59 +0500 Subject: [PATCH] /etc/hosts permission checking --- src/util.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util.zig b/src/util.zig index aef7ac3..40b3a97 100644 --- a/src/util.zig +++ b/src/util.zig @@ -1,9 +1,14 @@ +const std = @import("std"); + pub const IPs = struct { v4: [:0]const u8, v6: [:0]const u8, }; -pub fn check_perms() !void {} +pub fn check_perms() !void { + var f = try std.fs.openFileAbsolute("/etc/hosts", .{ .mode = .write_only }); + f.close(); +} pub fn get_input() ![:0]const u8 { return "stub";