Fix some warnings on GCC.

These aren't really anything to be concerned about, but making GCC feel good
about my code makes me feel better about my code.
This commit is contained in:
Jordan Bancino 2022-11-17 19:33:59 +00:00
parent 46cc1df385
commit 9597894356

View file

@ -143,8 +143,8 @@ main(int argc, char **argv)
TelodendriaConfig *tConfig = NULL; TelodendriaConfig *tConfig = NULL;
/* User validation */ /* User validation */
struct passwd *userInfo; struct passwd *userInfo = NULL;
struct group *groupInfo; struct group *groupInfo = NULL;
/* Signal handling */ /* Signal handling */
struct sigaction sigAction; struct sigaction sigAction;
@ -395,7 +395,7 @@ main(int argc, char **argv)
Log(lc, LOG_WARNING, "Unable to chroot into directory: %s.", tConfig->dataDir); Log(lc, LOG_WARNING, "Unable to chroot into directory: %s.", tConfig->dataDir);
} }
if (tConfig->uid && tConfig->gid) if (userInfo && groupInfo)
{ {
if (setgid(groupInfo->gr_gid) != 0 || setuid(userInfo->pw_uid) != 0) if (setgid(groupInfo->gr_gid) != 0 || setuid(userInfo->pw_uid) != 0)
{ {