From 2e51ade0591362b8d13048d3df41a3bc43043094 Mon Sep 17 00:00:00 2001 From: fanf Date: Thu, 27 Feb 2003 02:24:01 +0000 Subject: Be POSIXly correct in the handling of /dev/stdout -- it's a "magic cookie" not a special file. --- usr.bin/uudecode/uudecode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/uudecode/uudecode.c b/usr.bin/uudecode/uudecode.c index 3b30be1..7bf2fcc 100644 --- a/usr.bin/uudecode/uudecode.c +++ b/usr.bin/uudecode/uudecode.c @@ -226,7 +226,7 @@ decode2(void) } q = memcpy(p - n, pw->pw_dir, n); } - } else { + } else if (strcmp(q, "/dev/stdout") != 0) { /* strip down to leaf name */ p = strrchr(q, '/'); if (p != NULL) @@ -235,7 +235,8 @@ decode2(void) if (!oflag) outfile = q; - if (pflag) + /* POSIX says "/dev/stdout" is a 'magic cookie' not a special file. */ + if (pflag || strcmp(outfile, "/dev/stdout") == 0) outfp = stdout; else { flags = O_WRONLY|O_CREAT|O_EXCL; -- cgit v1.1