From: Michihiro NAKAJIMA Date: Mon, 20 Feb 2012 08:14:57 +0000 (+0900) Subject: On Windows, it is possible that the program name should have a slash '/' X-Git-Tag: v3.0.4~2^2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8eb4c87a87d4ae5e74848541460b366cabf863f2;p=thirdparty%2Flibarchive.git On Windows, it is possible that the program name should have a slash '/' character not only a backslash '\' character. We have to check both a slash and a backslash to get the running program name of bsdcpio or bsdtar. --- diff --git a/cpio/cpio.c b/cpio/cpio.c index 627e9c019..081f211e1 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -155,9 +155,9 @@ main(int argc, char *argv[]) else { #if defined(_WIN32) && !defined(__CYGWIN__) lafe_progname = strrchr(*argv, '\\'); -#else - lafe_progname = strrchr(*argv, '/'); + if (strrchr(*argv, '/') > lafe_progname) #endif + lafe_progname = strrchr(*argv, '/'); if (lafe_progname != NULL) lafe_progname++; else diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 52b5c91ba..b92ada1ec 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -179,9 +179,9 @@ main(int argc, char **argv) else { #if defined(_WIN32) && !defined(__CYGWIN__) lafe_progname = strrchr(*argv, '\\'); -#else - lafe_progname = strrchr(*argv, '/'); + if (strrchr(*argv, '/') > lafe_progname) #endif + lafe_progname = strrchr(*argv, '/'); if (lafe_progname != NULL) lafe_progname++; else