diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2019-06-29 20:29:49 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2020-07-14 15:52:44 +0200 |
commit | 55e8e7af8b816be93bc32d9abaaee3f03b7032f2 (patch) | |
tree | d41a3c4fad88f40f181ca49b0128d42aacb1118e | |
parent | 24c7cfaf1e792a840a99e6c47354a0e8f24869d4 (diff) |
check return values against -1 "reasonable" deraadt@
-rw-r--r-- | xenodm/auth.c | 9 | ||||
-rw-r--r-- | xenodm/dm.c | 2 | ||||
-rw-r--r-- | xenodm/session.c | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/xenodm/auth.c b/xenodm/auth.c index 0f9528d..810f4cf 100644 --- a/xenodm/auth.c +++ b/xenodm/auth.c @@ -160,10 +160,10 @@ CheckServerAuthDir (const char *path, struct stat *statb, int mode) { int r = stat(path, statb); - if (r != 0) { + if (r == -1) { if (errno == ENOENT) { r = mkdir(path, mode); - if (r < 0) { + if (r == -1) { LogError ("cannot make authentication directory %s: %s\n", path, _SysErrorMsg (errno)); } else { @@ -180,7 +180,6 @@ CheckServerAuthDir (const char *path, struct stat *statb, int mode) return -1; } } - return r; } @@ -251,7 +250,7 @@ MakeServerAuthFile (struct display *d, FILE ** file, uid_t uid, gid_t gid) snprintf (d->authFile, len, "%s/%s/%s/A%s-XXXXXX", authDir, authdir1, authdir2, cleanname); fd = mkstemp (d->authFile); - if (fd < 0) { + if (fd == -1) { LogError ("cannot make authentication file %s: %s\n", d->authFile, _SysErrorMsg (errno)); free (d->authFile); @@ -670,7 +669,7 @@ DefineSelf(FILE *file, Xauth *auth) int family, len; Debug("DefineSelf\n"); - if (getifaddrs(&ifap) < 0) + if (getifaddrs(&ifap) == -1) return; for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) { len = sizeof(*(ifr->ifa_addr)); diff --git a/xenodm/dm.c b/xenodm/dm.c index 59a0307..aab2453 100644 --- a/xenodm/dm.c +++ b/xenodm/dm.c @@ -91,7 +91,7 @@ main (int argc, char **argv) exit (1); } if (debugLevel == 0 && daemonMode) { - if (daemon (0, 0) < 0) { + if (daemon (0, 0) == -1) { /* error */ LogError("daemon() failed, %s\n", _SysErrorMsg (errno)); exit(1); diff --git a/xenodm/session.c b/xenodm/session.c index 99ed59b..048d695 100644 --- a/xenodm/session.c +++ b/xenodm/session.c @@ -334,7 +334,7 @@ StartClient ( Debug("login_fbtab %s %d\n", d->windowPath, geteuid()); login_fbtab(d->windowPath, pwd->pw_uid, pwd->pw_gid); } - if (setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL) < 0) { + if (setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL) == -1) { LogError ("setusercontext for \"%s\" failed: %s\n", name, _SysErrorMsg (errno)); return (0); |