From 04e7229db5aee2221165321f87ccd5cf605beef1 Mon Sep 17 00:00:00 2001 From: "Simon L. B. Nielsen" Date: Sat, 23 Apr 2011 13:07:35 +0000 Subject: [PATCH] Check return code of setuid() in traceroute. While it will not fail in normal circumstances, better safe than sorry. Reported by: LLVM's clang static analyzer MFC after: 3 days --- contrib/traceroute/traceroute.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c index db4d07510258..2a5fea218c81 100644 --- a/contrib/traceroute/traceroute.c +++ b/contrib/traceroute/traceroute.c @@ -509,7 +509,10 @@ main(int argc, char **argv) sockerrno = errno; } - setuid(getuid()); + if (setuid(getuid()) != 0) { + perror("setuid()"); + exit(1); + } #ifdef IPCTL_DEFTTL {