]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
main: fix possible NULL ptr on startup
authorAdam Sutton <dev@adamsutton.me.uk>
Sat, 9 Feb 2013 12:48:57 +0000 (12:48 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Sat, 9 Feb 2013 12:48:57 +0000 (12:48 +0000)
src/main.c

index be27a602e7db483340096133865a03de893b16d8..a9a506513388285ebf3537811d1a035705ce98fd 100644 (file)
@@ -514,7 +514,7 @@ main(int argc, char **argv)
     gid_t gid;
     uid_t uid;
     struct group  *grp = getgrnam(opt_group ?: "video");
-    struct passwd *pw  = getpwnam(opt_user) ?: NULL;
+    struct passwd *pw  = opt_user ? getpwnam(opt_user) : NULL;
     FILE   *pidfile    = fopen(opt_pidpath, "w+");
 
     if(grp != NULL) {