From: Arran Cudbard-Bell Date: Thu, 26 Jun 2014 00:24:19 +0000 (+0100) Subject: Check return code of write X-Git-Tag: release_3_0_4_rc2~171 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=commitdiff_plain;h=5b36dc81adf01fc3caa1d60776b41707a4395e84 Check return code of write --- diff --git a/src/lib/debug.c b/src/lib/debug.c index 49a0230..3d1b1a4 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -150,7 +150,9 @@ static int fr_debugger_attached(void) if (_PTRACE(PTRACE_ATTACH, ppid) == 0) { /* If we attached then we're not running under a debugger */ - write(from_child[1], &ret, sizeof(ret)); + if (write(from_child[1], &ret, sizeof(ret)) < 0) { + fprintf(stderr, "Writing ptrace status to parent failed: %s", fr_syserror(errno)); + } /* Wait for the parent to stop and continue it */ waitpid(ppid, NULL, 0); @@ -163,7 +165,9 @@ static int fr_debugger_attached(void) ret = 1; /* Something is already attached */ - write(from_child[1], &ret, 1); + if (write(from_child[1], &ret, 1) < 0) { + fprintf(stderr, "Writing ptrace status to parent failed: %s", fr_syserror(errno)); + } exit(0); /* Parent */