From: Andrew Tridgell Date: Thu, 19 Oct 2000 00:47:48 +0000 (+0000) Subject: don't clobber argv[0], so ps shows the right thing X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/c32d024071bd1519de936be65eaf8687260926ac don't clobber argv[0], so ps shows the right thing --- diff --git a/main.c b/main.c index 648c2371..e54ae8b0 100644 --- a/main.c +++ b/main.c @@ -557,11 +557,12 @@ static int start_client(int argc, char *argv[]) extern int am_sender; extern char *shell_cmd; extern int rsync_port; + char *argv0 = strdup(argv[0]); - if (strncasecmp(URL_PREFIX, argv[0], strlen(URL_PREFIX)) == 0) { + if (strncasecmp(URL_PREFIX, argv0, strlen(URL_PREFIX)) == 0) { char *host, *path; - host = argv[0] + strlen(URL_PREFIX); + host = argv0 + strlen(URL_PREFIX); p = strchr(host,'/'); if (p) { *p = 0; @@ -577,12 +578,12 @@ static int start_client(int argc, char *argv[]) return start_socket_client(host, path, argc-1, argv+1); } - p = find_colon(argv[0]); + p = find_colon(argv0); if (p) { if (p[1] == ':') { *p = 0; - return start_socket_client(argv[0], p+2, argc-1, argv+1); + return start_socket_client(argv0, p+2, argc-1, argv+1); } if (argc < 1) {