Upon failure, write a warning message and continue Found-by: covscan Signed-off-by: Uri Lublin <uril@xxxxxxxxxx> --- v1->v2: added a check for fopen too. --- src/vdagentd/vdagentd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c index 72a3e13..ba1b0c7 100644 --- a/src/vdagentd/vdagentd.c +++ b/src/vdagentd/vdagentd.c @@ -996,8 +996,13 @@ static void daemonize(void) } pidfile = fopen(pidfilename, "w"); if (pidfile) { - fprintf(pidfile, "%d\n", (int)getpid()); + int r = fprintf(pidfile, "%d\n", (int)getpid()); + if (r < 0) { + syslog(LOG_WARNING, "Error writing to %s: %m", pidfilename); + } fclose(pidfile); + } else { + syslog(LOG_WARNING, "Failed to create pidfile %s: %m", pidfilename); } break; case -1: -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel