[lxc-devel] [lxcfs/master] don't use argv[0] in usage output

evgeni on Github lxc-bot at linuxcontainers.org
Fri Aug 26 07:37:04 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 673 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160826/23ddd29d/attachment.bin>
-------------- next part --------------
From c3fb7d7fbdc2d9cb2e9e818ac8fce52442583921 Mon Sep 17 00:00:00 2001
From: Evgeni Golov <evgeni at debian.org>
Date: Fri, 26 Aug 2016 09:33:09 +0200
Subject: [PATCH] don't use argv[0] in usage output

otherwise this generates "funny" manpages like
  /home/remote/egolov/Devel/lxcfs/.libs/lt-lxcfs [-p pidfile] mountpoint
  /home/remote/egolov/Devel/lxcfs/.libs/lt-lxcfs -h
or
  /build/lxcfs-8lNGve/lxcfs-2.0/.1/.libs/lt-lxcfs [-p pidfile] mountpoint
  /build/lxcfs-8lNGve/lxcfs-2.0/.1/.libs/lt-lxcfs -h

Signed-off-by: Evgeni Golov <evgeni at debian.org>
---
 lxcfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lxcfs.c b/lxcfs.c
index 47afe13..e745ce5 100644
--- a/lxcfs.c
+++ b/lxcfs.c
@@ -708,13 +708,13 @@ const struct fuse_operations lxcfs_ops = {
 	.fgetattr = NULL,
 };
 
-static void usage(const char *me)
+static void usage()
 {
 	fprintf(stderr, "Usage:\n");
 	fprintf(stderr, "\n");
-	fprintf(stderr, "%s [-p pidfile] mountpoint\n", me);
+	fprintf(stderr, "lxcfs [-p pidfile] mountpoint\n");
 	fprintf(stderr, "  Default pidfile is %s/lxcfs.pid\n", RUNTIME_PATH);
-	fprintf(stderr, "%s -h\n", me);
+	fprintf(stderr, "lxcfs -h\n");
 	exit(1);
 }
 
@@ -838,7 +838,7 @@ int main(int argc, char *argv[])
 		exit(EXIT_SUCCESS);
 	}
 	if (argc != 2 || is_help(argv[1]))
-		usage(argv[0]);
+		usage();
 
 	do_reload();
 	if (signal(SIGUSR1, reload_handler) == SIG_ERR) {


More information about the lxc-devel mailing list