Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107873238
D45440.id139578.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
881 B
Referenced Files
None
Subscribers
None
D45440.id139578.diff
View Options
diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c
--- a/usr.bin/comm/comm.c
+++ b/usr.bin/comm/comm.c
@@ -129,12 +129,12 @@
/* if one file done, display the rest of the other file */
if (n1 < 0) {
- if (n2 >= 0 && col2 != NULL)
+ if (n2 >= 0)
show(fp2, argv[1], col2, &line2, &line2len);
break;
}
if (n2 < 0) {
- if (n1 >= 0 && col1 != NULL)
+ if (n1 >= 0)
show(fp1, argv[0], col1, &line1, &line1len);
break;
}
@@ -206,10 +206,12 @@
ssize_t n;
do {
- (void)printf("%s%s\n", offset, *bufp);
+ /* offset is NULL when draining fp, not printing */
+ if (offset != NULL)
+ (void)printf("%s%s\n", offset, *bufp);
if ((n = getline(bufp, buflenp, fp)) < 0)
break;
- if (n > 0 && (*bufp)[n - 1] == '\n')
+ if (n > 0 && offset != NULL && (*bufp)[n - 1] == '\n')
(*bufp)[n - 1] = '\0';
} while (1);
if (ferror(fp))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 9:53 PM (7 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15961697
Default Alt Text
D45440.id139578.diff (881 B)
Attached To
Mode
D45440: comm: close a race condition when comm is fed from stdin
Attached
Detach File
Event Timeline
Log In to Comment