diff mbox

[04/17] get/setcifsacl: set "prog" via basename(argv[0])

Message ID 1351947034-18876-5-git-send-email-jlayton@samba.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton Nov. 3, 2012, 12:50 p.m. UTC
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 | 3 ++-
 setcifsacl.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/getcifsacl.c b/getcifsacl.c
index 8cbdb1d..da4bb67 100644
--- a/getcifsacl.c
+++ b/getcifsacl.c
@@ -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) {
diff --git a/setcifsacl.c b/setcifsacl.c
index 380adac..50822e6 100644
--- a/setcifsacl.c
+++ b/setcifsacl.c
@@ -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:?");