diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2008-09-30 21:29:59 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2008-09-30 21:29:59 +0000 |
commit | 8743de12adfdd4e8e465ddeee706ee217e331fe8 (patch) | |
tree | f5ac539ef2a234de90daffdc1c30c9a27d519522 | |
parent | 7c891a9ddf9581405da35122b4e6b1c76671480d (diff) |
Properly display files with embedded colons being xferred via ftd.
Closes PR 5119. OK miod@
-rw-r--r-- | usr.bin/w/w.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 4331b1121e4..dbe9f106b4e 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -1,4 +1,4 @@ -/* $OpenBSD: w.c,v 1.45 2005/07/20 04:19:08 jaredy Exp $ */ +/* $OpenBSD: w.c,v 1.46 2008/09/30 21:29:58 millert Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94"; #else -static char *rcsid = "$OpenBSD: w.c,v 1.45 2005/07/20 04:19:08 jaredy Exp $"; +static char *rcsid = "$OpenBSD: w.c,v 1.46 2008/09/30 21:29:58 millert Exp $"; #endif #endif /* not lint */ @@ -357,10 +357,14 @@ pr_args(struct kinfo_proc2 *kp) fmt_putc(')', &left); } while (*argv) { - /* ftp is a special case... */ + /* + * ftp argv[0] is in the following format: + * ftpd: HOSTNAME: [USER/PASS: ]CMD args (ftpd) + */ if (strncmp(*argv, "ftpd:", 5) == 0) { - str = strrchr(*argv, ':'); - if (str != (char *)NULL) { + if ((str = strchr(*argv + 5, ':')) != NULL) + str = strchr(str + 1, ':'); + if (str != NULL) { if ((str[0] == ':') && isspace(str[1])) str += 2; fmt_puts(str, &left); |