Rework some code with the intent of making it more straightfoward,
which also eliminates a false positive.
Check the return value from PosixUnlink and log a warning on error.
if (success) {
result[nArgs - 1] = DynBuf_Detach(&b);
} else {
- if (nArgs != 0) {
- Util_FreeStringList(result, nArgs);
- }
-
+ Util_FreeStringList(result, nArgs);
result = NULL;
}
* with another process attempting to daemonize and unlinking the
* file it created instead.
*/
- Posix_Unlink(pidPath);
+ if (Posix_Unlink(pidPath) != 0) {
+ Warning("%s: Unable to unlink %s: %u\n",
+ __FUNCTION__, pidPath, errno);
+ }
}
errno = err;