summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfanf <fanf@FreeBSD.org>2003-02-27 02:24:01 +0000
committerfanf <fanf@FreeBSD.org>2003-02-27 02:24:01 +0000
commit2e51ade0591362b8d13048d3df41a3bc43043094 (patch)
treeb89e49790d3ef991499943b0d68ae7e9a92b5b7d
parent3fc9836d46e83fd0a5d0daa46f5639be3db193c1 (diff)
downloadFreeBSD-src-2e51ade0591362b8d13048d3df41a3bc43043094.zip
FreeBSD-src-2e51ade0591362b8d13048d3df41a3bc43043094.tar.gz
Be POSIXly correct in the handling of /dev/stdout -- it's a "magic cookie"
not a special file.
-rw-r--r--usr.bin/uudecode/uudecode.c5
1 files 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;
OpenPOWER on IntegriCloud