From: ceriel Date: Thu, 9 Jul 1992 14:02:43 +0000 (+0000) Subject: strip did not truncate file X-Git-Tag: release-5-5~426 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=80f5ecf6373f2ed471af3e8c655c0698913de85a;p=ack.git strip did not truncate file --- diff --git a/util/amisc/astrip.c b/util/amisc/astrip.c index 062c486da..66fa1cfba 100644 --- a/util/amisc/astrip.c +++ b/util/amisc/astrip.c @@ -93,16 +93,16 @@ char *name; rd_close(); close(fw); size += SZ_HEAD; - fw = open(name, 1); - if (fw < 0) { - fprintf(stderr, "astrip: cannot write %s\n", name); - return(1); - } if (! rd_open(tname)) { fprintf(stderr, "astrip: cannot read temp file %s\n", tname); - close(fw); return(2); } + fw = creat(name, 0777); + if (fw < 0) { + fprintf(stderr, "astrip: cannot write %s\n", name); + rd_close(); + return(1); + } if(copy(tname, name, size, rd_fd(), fw)) { close(fw); rd_close();