X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Futils.c;h=3428d312d6ee8a2c562936284bf86690229be56f;hp=e7dccb7b7490cb1c1392461304e70ea7cbf5d390;hb=e205d79b4dc22178644fa6f3d0a4eae86df36e73;hpb=8f7a281b62b77af66d5f24a3aade40bcd021d3ec diff --git a/src/common/utils.c b/src/common/utils.c index e7dccb7b7..3428d312d 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -477,10 +477,14 @@ int utils_create_pid_file(pid_t pid, const char *filepath) 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; }