summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpio/cpio.c4
-rw-r--r--libarchive_fe/err.c6
-rw-r--r--libarchive_fe/err.h2
-rw-r--r--tar/bsdtar.c4
4 files changed, 7 insertions, 9 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index 933bedf3..98fd83cc 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -150,9 +150,7 @@ main(int argc, char *argv[])
#endif
/* Set lafe_progname before calling lafe_warnc. */
- if (*argv == NULL)
- *argv = "bsdcpio";
- lafe_setprogname(*argv);
+ lafe_setprogname(*argv, "bsdcpio");
#if HAVE_SETLOCALE
if (setlocale(LC_ALL, "") == NULL)
diff --git a/libarchive_fe/err.c b/libarchive_fe/err.c
index 408c2029..8618a94e 100644
--- a/libarchive_fe/err.c
+++ b/libarchive_fe/err.c
@@ -52,9 +52,11 @@ lafe_getprogname(void)
}
void
-lafe_setprogname(const char *name)
+lafe_setprogname(const char *name, const char *defaultname)
{
-
+
+ if (name == NULL)
+ name = defaultname;
#if defined(_WIN32) && !defined(__CYGWIN__)
lafe_progname = strrchr(name, '\\');
if (strrchr(name, '/') > lafe_progname)
diff --git a/libarchive_fe/err.h b/libarchive_fe/err.h
index c351cba8..ebf5de81 100644
--- a/libarchive_fe/err.h
+++ b/libarchive_fe/err.h
@@ -45,6 +45,6 @@ void lafe_errc(int eval, int code, const char *fmt, ...) __LA_DEAD
__LA_PRINTFLIKE(3, 4);
const char * lafe_getprogname(void);
-void lafe_setprogname(const char *);
+void lafe_setprogname(const char *name, const char *defaultname);
#endif
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index 8b05b401..d743718f 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -179,9 +179,7 @@ main(int argc, char **argv)
#endif
/* Set lafe_progname before calling lafe_warnc. */
- if (*argv == NULL)
- *argv = "bsdtar";
- lafe_setprogname(*argv);
+ lafe_setprogname(*argv, "bsdtar");
#if HAVE_SETLOCALE
if (setlocale(LC_ALL, "") == NULL)