ret = fprintf(fp, "%d\n", pid);
if (ret < 0) {
PERROR("fprintf pid file");
+ goto error;
}
- fclose(fp);
+ if (fclose(fp)) {
+ PERROR("fclose");
+ }
DBG("Pid %d written in file %s", pid, filepath);
+ ret = 0;
error:
return ret;
}
if (ret) {
WARN("Could not get lock file %s, another instance is running.",
filepath);
- close(fd);
+ if (close(fd)) {
+ PERROR("close lock file");
+ }
fd = ret;
goto error;
}