check return values against -1 "reasonable" deraadt@
This commit is contained in:
parent
04c7986e14
commit
41003a131f
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user