Page MenuHomeFreeBSD

D43532.id.diff
No OneTemporary

D43532.id.diff

diff --git a/usr.bin/bintrans/uudecode.c b/usr.bin/bintrans/uudecode.c
--- a/usr.bin/bintrans/uudecode.c
+++ b/usr.bin/bintrans/uudecode.c
@@ -331,11 +331,22 @@
warnx("%s: %s: %s", infile, outfile, msg);
return (1);
}
- if (fclose(outfp) != 0) {
+ return (0);
+}
+
+static int
+checkout(int rval)
+{
+ if (fflush(outfp) != 0) {
warn("%s: %s", infile, outfile);
- return (1);
+ rval = 1;
}
- return (0);
+ if (outfp != stdout) {
+ (void)fclose(outfp);
+ outfp = stdout;
+ }
+ outfile = "/dev/stdout";
+ return (rval);
}
static int
@@ -349,9 +360,9 @@
for (;;) {
switch (get_line(buf, sizeof(buf))) {
case 0:
- return (0);
+ return (checkout(0));
case 1:
- return (1);
+ return (checkout(1));
}
#define DEC(c) (((c) - ' ') & 077) /* single character decode */
@@ -408,11 +419,11 @@
}
switch (get_line(buf, sizeof(buf))) {
case 0:
- return (0);
+ return (checkout(0));
case 1:
- return (1);
+ return (checkout(1));
default:
- return (checkend(buf, "end", "no \"end\" line"));
+ return (checkout(checkend(buf, "end", "no \"end\" line")));
}
}
@@ -430,9 +441,9 @@
switch (get_line(inbuf + strlen(inbuf),
sizeof(inbuf) - strlen(inbuf))) {
case 0:
- return (0);
+ return (checkout(0));
case 1:
- return (1);
+ return (checkout(1));
}
count = 0;
@@ -459,7 +470,7 @@
break;
fwrite(outbuf, 1, n, outfp);
}
- return (checkend(inbuf, "====", "error decoding base64 input stream"));
+ return (checkout(checkend(inbuf, "====", "error decoding base64 input stream")));
}
static void
diff --git a/usr.bin/bintrans/uuencode.c b/usr.bin/bintrans/uuencode.c
--- a/usr.bin/bintrans/uuencode.c
+++ b/usr.bin/bintrans/uuencode.c
@@ -74,7 +74,7 @@
if (w != NULL)
columns = arg_to_col(w);
base64_encode();
- if (ferror(output))
+ if (fflush(output) != 0)
errx(1, "write error");
exit(0);
}
@@ -144,7 +144,7 @@
base64_encode();
else
encode();
- if (ferror(output))
+ if (fflush(output) != 0)
errx(1, "write error");
exit(0);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 27, 11:38 PM (2 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12953506
Default Alt Text
D43532.id.diff (1 KB)

Event Timeline