strip did not truncate file

This commit is contained in:
ceriel 1992-07-09 14:02:43 +00:00
parent 0b063462ef
commit 80f5ecf637

View file

@ -93,16 +93,16 @@ char *name;
rd_close(); rd_close();
close(fw); close(fw);
size += SZ_HEAD; size += SZ_HEAD;
fw = open(name, 1);
if (fw < 0) {
fprintf(stderr, "astrip: cannot write %s\n", name);
return(1);
}
if (! rd_open(tname)) { if (! rd_open(tname)) {
fprintf(stderr, "astrip: cannot read temp file %s\n", tname); fprintf(stderr, "astrip: cannot read temp file %s\n", tname);
close(fw);
return(2); 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)) { if(copy(tname, name, size, rd_fd(), fw)) {
close(fw); close(fw);
rd_close(); rd_close();