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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 getcifsacl.c | 3 ++-
 setcifsacl.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

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:?");
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux