aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/msgs
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-10-22 03:07:05 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-10-22 03:07:05 +0000
commit50e04779c499d5c329d1863b71ecd7c2b5824f76 (patch)
tree90ec7fe4bf0dae506d699603babb4917082f098a /usr.bin/msgs
parentc969ca9408ebdda12176a10520a73ea4f7a3c23c (diff)
downloadsrc-50e04779c499d5c329d1863b71ecd7c2b5824f76.tar.gz
src-50e04779c499d5c329d1863b71ecd7c2b5824f76.zip
Check the return error of set[e][ug]id. While this can never fail in the
current version of FreeBSD, this isn't guarenteed by the API. Custom security modules, or future implementations of the setuid and setgid may fail. Submitted by: Erik Cederstrand Approved by: cperciva MFC after: 3 days
Notes
Notes: svn path=/head/; revision=241848
Diffstat (limited to 'usr.bin/msgs')
-rw-r--r--usr.bin/msgs/msgs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index e534fac83da8..c4c589e168e1 100644
--- a/usr.bin/msgs/msgs.c
+++ b/usr.bin/msgs/msgs.c
@@ -175,7 +175,8 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
time(&t);
- setuid(uid = getuid());
+ if (setuid(uid = getuid()) != 0)
+ err(1, "setuid failed");
ruptible = (signal(SIGINT, SIG_IGN) == SIG_DFL);
if (ruptible)
signal(SIGINT, SIG_DFL);