get/setcifsacl: set "prog" via basename(argv[0])
authorJeff Layton <jlayton@samba.org>
Wed, 7 Nov 2012 15:19:15 +0000 (10:19 -0500)
committerJeff Layton <jlayton@samba.org>
Wed, 7 Nov 2012 15:19:15 +0000 (10:19 -0500)
This saves a tiny bit of memory, and doesn't make the program assume
that the binary is named something in particular.

Signed-off-by: Jeff Layton <jlayton@samba.org>
getcifsacl.c
setcifsacl.c

index 8cbdb1d6585b2b17f33f7153a779df88236da03c..da4bb67639c645b6901d91b6b0a1b09804e65a52 100644 (file)
@@ -38,7 +38,7 @@
 #include <sys/xattr.h>
 #include "cifsacl.h"
 
-static const char *prog = "getcifsacl";
+static const char *prog;
 
 static void
 print_each_ace_mask(uint32_t mask)
@@ -333,6 +333,7 @@ main(const int argc, char *const argv[])
        size_t bufsize = BUFSIZE;
        char *filename, *attrval;
 
+       prog = basename(argv[0]);
        openlog(prog, 0, LOG_DAEMON);
 
        while ((c = getopt_long(argc, argv, "r:v", NULL, NULL)) != -1) {
index 380adac4eabfb8f93d0bb4880dbf1c935f126f09..50822e698e125c2b8b69383e7e1f445ac530177c 100644 (file)
@@ -39,7 +39,7 @@
 #include <sys/xattr.h>
 #include "cifsacl.h"
 
-static const char *prog = "setcifsacl";
+static const char *prog;
 
 static void
 copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
@@ -775,6 +775,8 @@ main(const int argc, char *const argv[])
        struct cifs_ace **cacesptr = NULL, **facesptr = NULL;
        struct cifs_ntsd *ntsdptr = NULL;
 
+       prog = basename(argv[0]);
+
        openlog(prog, 0, LOG_DAEMON);
 
        c = getopt(argc, argv, "v:D:M:a:S:?");