From: Michael Orlitzky Date: Sun, 12 Aug 2012 23:44:37 +0000 (-0400) Subject: Add -Wall and fix warnings. X-Git-Tag: v0.0.1~20 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=b09e79496d929d0e310ffeeb9e28c8949a56e10b;p=apply-default-acl.git Add -Wall and fix warnings. --- diff --git a/makefile b/makefile index d6be6c5..ffe3a9e 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -O2 -march=native -pipe +CFLAGS = -O2 -march=native -pipe -Wall LIBS = -lacl SOURCES := $(shell find ./src -type f -name '*.c') diff --git a/src/aclq.c b/src/aclq.c index 6ea2e1d..9e456e4 100644 --- a/src/aclq.c +++ b/src/aclq.c @@ -9,6 +9,7 @@ #include /* ACLs */ +#include /* acl_get_perm, not portable */ #include #include @@ -297,7 +298,7 @@ bool reapply_default_acl(const char* path) { /* dirname mangles its argument */ char path_copy[PATH_MAX]; strncpy(path_copy, path, PATH_MAX-1); - path_copy[PATH_MAX] = 0; + path_copy[PATH_MAX-1] = 0; char* parent = dirname(path_copy); if (!is_directory(parent)) { @@ -348,7 +349,7 @@ bool reapply_default_acl(const char* path) { /* For the group bits, we'll use the ACL's mask instead of the group object bits. If the default ACL had a group entry, it should - already have propagated (but might be masked. */ + already have propagated (but might be masked). */ if (has_default_mask_read(parent)) { path_mode |= S_IRGRP; }