git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit869bce2df3caff7e4b919bab726b221ba9616e46
parent56b0d5c0e5
authorLeon Henrik Plickat <[email protected]>
date2022-06-06 21:53
river: error out if default init is not executable

 river/main.zig | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/river/main.zig b/river/main.zig
index e98ff4c..b0e6579 100644
--- a/river/main.zig
+++ b/river/main.zig
@@ -140,6 +140,12 @@ fn defaultInitPath() !?[:0]const u8 {
     };
 
     os.accessZ(path, os.X_OK) catch |err| {
+        if (err == error.PermissionDenied) {
+            if (os.accessZ(path, os.R_OK)) {
+                std.log.err("failed to run init executable {s}: the file is not executable", .{path});
+                os.exit(1);
+            } else |_| {}
+        }
         std.log.err("failed to run init executable {s}: {s}", .{ path, @errorName(err) });
         util.gpa.free(path);
         return null;