File System Race Condition at file-copy.c:32 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
file_copy_to_tmp (/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/file-copy.c)![]() | ||||||
![]() | ||||||
13 | static int file_copy_to_tmp(const char *srcpath, const char *tmppath, | |||||
14 | bool try_hardlink) | |||||
15 | { | |||||
16 | struct istream *input; | |||||
17 | struct ostream *output; | |||||
18 | struct stat st; | |||||
19 | mode_t old_umask; | |||||
20 | int fd_in, fd_out; | |||||
21 | off_t ret; | |||||
22 | ||||||
23 | if (try_hardlink) { | |||||
24 | /* see if hardlinking works */ | |||||
25 | if (link(srcpath, tmppath) == 0) | |||||
26 | return 1; | |||||
27 | if (errno == EEXIST) { | |||||
28 | if (unlink(tmppath) < 0 && errno != ENOENT) { | |||||
29 | i_error("unlink(%s) failed: %m", tmppath); | |||||
30 | return -1; | |||||
31 | } | |||||
32 | if (link(srcpath, tmppath) == 0)
| |||||
![]() |