← Commit list

35a5b08ee

Glenn L McGrath
Glenn L McGrath
2003-04-21
FAILED Duration: 86s

Subject

unlink() an existing file, before opening it, simply truncating can cause nasty problems if overwriting glibc, spotted by waldi.

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

archival/tar.c+2 -1
@@ -472,7 +472,8 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag,
tbInfo.tarFd = fileno(stdout);
tbInfo.verboseFlag = verboseFlag ? 2 : 0;
} else {
- tbInfo.tarFd = open(tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ unlink(tarName);
+ tbInfo.tarFd = open(tarName, O_WRONLY | O_CREAT | O_EXCL, 0644);
tbInfo.verboseFlag = verboseFlag ? 1 : 0;
}