mirror of git://git.suckless.org/ubase
dd: always create of= even if seek= is used
This commit is contained in:
parent
0e7ab0ca9e
commit
05a69d9d0d
4
dd.c
4
dd.c
|
@ -42,7 +42,7 @@ static int
|
|||
prepare_copy(struct dd_config *ddc, int *ifd, int *ofd)
|
||||
{
|
||||
struct stat st;
|
||||
int fli = O_RDONLY|O_LARGEFILE|O_NOCTTY, flo = O_WRONLY|O_LARGEFILE|O_NOATIME|O_NOCTTY;
|
||||
int fli = O_RDONLY|O_LARGEFILE|O_NOCTTY, flo = O_WRONLY|O_LARGEFILE|O_CREAT|O_NOATIME|O_NOCTTY;
|
||||
uid_t euid = 0;
|
||||
long pagesize;
|
||||
|
||||
|
@ -106,7 +106,7 @@ prepare_copy(struct dd_config *ddc, int *ifd, int *ofd)
|
|||
}
|
||||
|
||||
if (!ddc->seek)
|
||||
flo |= O_CREAT|O_TRUNC;
|
||||
flo |= O_TRUNC;
|
||||
|
||||
if (!ddc->out) *ofd = 1;
|
||||
else if ((*ofd = open(ddc->out, flo, st.st_mode)) < 0) {
|
||||
|
|
Loading…
Reference in New Issue