Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136857679
D48196.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
938 B
Referenced Files
None
Subscribers
None
D48196.diff
View Options
diff --git a/usr.bin/tee/tee.c b/usr.bin/tee/tee.c
--- a/usr.bin/tee/tee.c
+++ b/usr.bin/tee/tee.c
@@ -57,11 +57,9 @@
int
main(int argc, char *argv[])
{
+ char *bp, *buf;
struct entry *p;
- int n, fd, rval, wval;
- char *bp;
- int append, ch, exitval;
- char *buf;
+ int append, ch, exitval, fd, n, oflags, rval, wval;
#define BSIZE (8 * 1024)
append = 0;
@@ -88,13 +86,20 @@
add(STDOUT_FILENO, "stdout");
- for (exitval = 0; *argv; ++argv)
- if ((fd = open(*argv, append ? O_WRONLY|O_CREAT|O_APPEND :
- O_WRONLY|O_CREAT|O_TRUNC, DEFFILEMODE)) < 0) {
+ oflags = O_WRONLY | O_CREAT;
+ if (append)
+ oflags |= O_APPEND;
+ else
+ oflags |= O_TRUNC;
+
+ for (exitval = 0; *argv; ++argv) {
+ if ((fd = open(*argv, oflags, DEFFILEMODE)) < 0) {
warn("%s", *argv);
exitval = 1;
- } else
+ } else {
add(fd, *argv);
+ }
+ }
if (caph_enter() < 0)
err(EXIT_FAILURE, "unable to enter capability mode");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 21, 3:59 AM (10 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25749745
Default Alt Text
D48196.diff (938 B)
Attached To
Mode
D48196: tee: minor cleanup
Attached
Detach File
Event Timeline
Log In to Comment