X-Git-Url: http://gitweb.michael.orlitzky.com/?p=apply-default-acl.git;a=blobdiff_plain;f=src%2Fapply-default-acl.c;h=bebb27c9907cb43f4bfb43599b483b5c568c189d;hp=ea3ef6491a2d1ab374d707f86822439c21809be3;hb=71831f01c40806756b6640591fca739c7790aebe;hpb=0b4ff086871b13edb9da3bda67ac4b6f710e73dd diff --git a/src/apply-default-acl.c b/src/apply-default-acl.c index ea3ef64..bebb27c 100644 --- a/src/apply-default-acl.c +++ b/src/apply-default-acl.c @@ -9,6 +9,7 @@ #define _XOPEN_SOURCE 500 #define _GNU_SOURCE +#include /* EINVAL */ #include /* AT_FOO constants */ #include /* nftw() et al. */ #include /* getopt_long() */ @@ -67,6 +68,11 @@ bool path_accessible(const char* path) { * */ void usage(const char* program_name) { + if (program_name == NULL) { + /* ??? */ + return; + } + printf("Apply any applicable default ACLs to the given files or " "directories.\n\n"); printf("Usage: %s [flags] [ [ ...]]\n\n", @@ -96,6 +102,13 @@ int apply_default_acl_nftw(const char *target, int info, struct FTW *ftw) { + if (target == NULL) { + errno = EINVAL; + perror("apply_default_acl_nftw (args)"); + return ACL_ERROR; + } + + if (apply_default_acl_ex(target, sp, false) == ACL_ERROR) { /* I guess we do want to bail out for serious/unexpected errors? */ return ACL_ERROR; @@ -119,6 +132,12 @@ int apply_default_acl_nftw_x(const char *target, int info, struct FTW *ftw) { + if (target == NULL) { + errno = EINVAL; + perror("apply_default_acl_nftw_x (args)"); + return ACL_ERROR; + } + if (apply_default_acl_ex(target, sp, true) == ACL_ERROR) { /* I guess we do want to bail out for serious/unexpected errors? */ return ACL_ERROR; @@ -148,6 +167,12 @@ int apply_default_acl_nftw_x(const char *target, * then we return @c ACL_ERROR. Otherwise, we return @c ACL_SUCCESS. */ int apply_default_acl_recursive(const char *target, bool no_exec_mask) { + if (target == NULL) { + errno = EINVAL; + perror("apply_default_acl_recursive (args)"); + return ACL_ERROR; + } + int max_levels = 256; int flags = FTW_MOUNT | FTW_PHYS;