SCCS-vsn: bin/dd/dd.c 4.5
static char *sccsid = "@(#)dd.c 4.5 (Berkeley) %G%";
#endif
static char *sccsid = "@(#)dd.c 4.5 (Berkeley) %G%";
#endif
#include <stdio.h>
#include <signal.h>
#include <stdio.h>
#include <signal.h>
perror(ifile);
exit(1);
}
perror(ifile);
exit(1);
}
- if (ofile)
- obf = creat(ofile, 0666);
- else
- obf = dup(1);
+ obf = ofile ? open(ofile, O_WRONLY|O_CREAT, 0666) : dup(1);
if(obf < 0) {
fprintf(stderr,"cannot create: %s\n", ofile);
exit(1);
if(obf < 0) {
fprintf(stderr,"cannot create: %s\n", ofile);
exit(1);