Useless Assignment at nfs-workarounds.c:140 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
nfs_safe_link (/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/nfs-workarounds.c)![]() | ||||||
![]() | ||||||
116 | int nfs_safe_link(const char *oldpath, const char *newpath, bool links1) | |||||
117 | { | |||||
118 | struct stat st; | |||||
119 | nlink_t orig_link_count = 1; | |||||
120 | ||||||
121 | if (!links1) { | |||||
122 | if (stat(oldpath, &st) < 0) | |||||
123 | return -1; | |||||
124 | orig_link_count = st.st_nlink; | |||||
125 | } | |||||
126 | ||||||
127 | if (link(oldpath, newpath) == 0) { | |||||
128 | #ifndef __FreeBSD__ | |||||
129 | return 0; | |||||
130 | #endif | |||||
131 | /* FreeBSD at least up to v6.2 converts EEXIST errors to | |||||
132 | success. */ | |||||
133 | } else if (errno != EEXIST) | |||||
134 | return -1; | |||||
135 | ||||||
136 | /* We don't know if it succeeded or failed. stat() to make sure. */ | |||||
137 | if (stat(oldpath, &st) < 0) | |||||
138 | return -1; | |||||
139 | if (st.st_nlink == orig_link_count) { | |||||
140 | errno = EEXIST;
| |||||
141 | return -1; | |||||
142 | } | |||||
143 | return 0; | |||||
144 | } | |||||
![]() |