diff options
Diffstat (limited to 'tests/nt.c')
-rw-r--r-- | tests/nt.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -282,19 +282,19 @@ netcat (char const *urlstr) static void redirect (int sfd, char const *name) { int fd; - fd = open (name, sfd ? (O_WRONLY | O_TRUNC) : O_RDONLY); - if (!fd) + fd = open (name, sfd ? (O_CREAT | O_TRUNC | O_WRONLY) : O_RDONLY, 0644); + if (fd == -1) { perror (name); exit (1); } - if (dup2 (fd, sfd)) + if (dup2 (fd, sfd) == -1) { perror ("dup2"); exit (1); } } |