All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: linux-xfs@vger.kernel.org
Cc: Khem Raj <raj.khem@gmail.com>
Subject: [PATCH] Rename progname as it is provided by libc
Date: Sat,  2 Sep 2017 14:54:51 -0700	[thread overview]
Message-ID: <20170902215451.29265-1-raj.khem@gmail.com> (raw)

Rename local variable progname to avoid a clash with libc
global symbols

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 io/init.c                 | 10 +++++-----
 mdrestore/xfs_mdrestore.c | 10 +++++-----
 quota/init.c              | 10 +++++-----
 spaceman/init.c           |  8 ++++----
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/io/init.c b/io/init.c
index 20d5f80..e82e101 100644
--- a/io/init.c
+++ b/io/init.c
@@ -23,7 +23,7 @@
 #include "init.h"
 #include "io.h"
 
-char	*progname;
+char	*io_progname;
 int	exitcode;
 int	expert;
 int	idlethread;
@@ -35,7 +35,7 @@ usage(void)
 {
 	fprintf(stderr,
 _("Usage: %s [-adfinrRstVx] [-m mode] [-p prog] [[-c|-C] cmd]... file\n"),
-		progname);
+		io_progname);
 	exit(1);
 }
 
@@ -142,7 +142,7 @@ init(
 	xfs_fsop_geom_t	geometry = { 0 };
 	struct fs_path	fsp;
 
-	progname = basename(argv[0]);
+	io_progname = basename(argv[0]);
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
@@ -186,7 +186,7 @@ init(
 			flags |= IO_NONBLOCK;
 			break;
 		case 'p':
-			progname = optarg;
+			io_progname = optarg;
 			break;
 		case 'r':
 			flags |= IO_READONLY;
@@ -207,7 +207,7 @@ init(
 			expert = 1;
 			break;
 		case 'V':
-			printf(_("%s version %s\n"), progname, VERSION);
+			printf(_("%s version %s\n"), io_progname, VERSION);
 			exit(0);
 		default:
 			usage();
diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c
index 9d1b4e8..b840a54 100644
--- a/mdrestore/xfs_mdrestore.c
+++ b/mdrestore/xfs_mdrestore.c
@@ -19,7 +19,7 @@
 #include "libxfs.h"
 #include "xfs_metadump.h"
 
-char 		*progname;
+char 		*mdrestore_progname;
 int		show_progress = 0;
 int		show_info = 0;
 int		progress_since_warning = 0;
@@ -30,7 +30,7 @@ fatal(const char *msg, ...)
 	va_list		args;
 
 	va_start(args, msg);
-	fprintf(stderr, "%s: ", progname);
+	fprintf(stderr, "%s: ", mdrestore_progname);
 	vfprintf(stderr, msg, args);
 	exit(1);
 }
@@ -194,7 +194,7 @@ perform_restore(
 static void
 usage(void)
 {
-	fprintf(stderr, "Usage: %s [-V] [-g] source target\n", progname);
+	fprintf(stderr, "Usage: %s [-V] [-g] source target\n", mdrestore_progname);
 	exit(1);
 }
 
@@ -212,7 +212,7 @@ main(
 	struct stat	statbuf;
 	int		is_target_file;
 
-	progname = basename(argv[0]);
+	mdrestore_progname = basename(argv[0]);
 
 	while ((c = getopt(argc, argv, "giV")) != EOF) {
 		switch (c) {
@@ -223,7 +223,7 @@ main(
 				show_info = 1;
 				break;
 			case 'V':
-				printf("%s version %s\n", progname, VERSION);
+				printf("%s version %s\n", mdrestore_progname, VERSION);
 				exit(0);
 			default:
 				usage();
diff --git a/quota/init.c b/quota/init.c
index d45dc4c..46403de 100644
--- a/quota/init.c
+++ b/quota/init.c
@@ -21,7 +21,7 @@
 #include "input.h"
 #include "init.h"
 
-char	*progname;
+char	*quota_progname;
 int	exitcode;
 int	expert;
 bool	foreign_allowed = false;
@@ -47,7 +47,7 @@ usage(void)
 {
 	fprintf(stderr,
 		_("Usage: %s [-V] [-x] [-f] [-p prog] [-c cmd]... [-d project]... [path]\n"),
-		progname);
+		quota_progname);
 	exit(1);
 }
 
@@ -147,7 +147,7 @@ init(
 {
 	int		c;
 
-	progname = basename(argv[0]);
+	quota_progname = basename(argv[0]);
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
@@ -173,13 +173,13 @@ init(
 			projid_file = optarg;
 			break;
 		case 'p':
-			progname = optarg;
+			quota_progname = optarg;
 			break;
 		case 'x':
 			expert++;
 			break;
 		case 'V':
-			printf(_("%s version %s\n"), progname, VERSION);
+			printf(_("%s version %s\n"), quota_progname, VERSION);
 			exit(0);
 		default:
 			usage();
diff --git a/spaceman/init.c b/spaceman/init.c
index b3eface..bedf112 100644
--- a/spaceman/init.c
+++ b/spaceman/init.c
@@ -23,7 +23,7 @@
 #include "path.h"
 #include "space.h"
 
-char	*progname;
+char	*spaceman_progname;
 int	exitcode;
 
 void
@@ -31,7 +31,7 @@ usage(void)
 {
 	fprintf(stderr,
 		_("Usage: %s [-c cmd] file\n"),
-		progname);
+		spaceman_progname);
 	exit(1);
 }
 
@@ -74,7 +74,7 @@ init(
 	xfs_fsop_geom_t	geometry = { 0 };
 	struct fs_path	fsp;
 
-	progname = basename(argv[0]);
+	spaceman_progname = basename(argv[0]);
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
@@ -86,7 +86,7 @@ init(
 			add_user_command(optarg);
 			break;
 		case 'V':
-			printf(_("%s version %s\n"), progname, VERSION);
+			printf(_("%s version %s\n"), spaceman_progname, VERSION);
 			exit(0);
 		default:
 			usage();
-- 
2.14.1


             reply	other threads:[~2017-09-02 21:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-02 21:54 Khem Raj [this message]
2017-09-02 22:20 ` [PATCH] Rename progname as it is provided by libc Dave Chinner
2017-09-02 23:42   ` Khem Raj
2017-09-03  7:21   ` Khem Raj
2017-09-03  7:48   ` Christoph Hellwig
2017-09-08 16:25 ` Eric Sandeen
2017-09-08 16:29   ` Khem Raj
2017-09-08 18:13   ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170902215451.29265-1-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.