[hackers] [ubase] dd: always create of= even if seek= is used || Eivind Uggedal
commit 05a69d9d0decf9e8d5037bd8d20bb20c235b2017
Author: Eivind Uggedal <eivind_AT_uggedal.com>
AuthorDate: Tue Mar 15 16:02:33 2016 +0000
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Mar 16 10:17:51 2016 +0000
dd: always create of= even if seek= is used
diff --git a/dd.c b/dd.c
index 977f0f0..e37c6c7 100644
--- a/dd.c
+++ b/dd.c
_AT_@ -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;
_AT_@ -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) {
Received on Wed Mar 16 2016 - 11:18:16 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 16 2016 - 11:24:16 CET