fix order of tests to avoid strstr on NULL value

This commit is contained in:
Gilles Depeyrot
2021-07-16 09:36:54 +08:00
committed by Max Lv
parent 0a7d178134
commit abcf85e983
+1 -1
View File
@@ -1123,7 +1123,7 @@ main(int argc, char **argv)
if (workdir == NULL || strlen(workdir) == 0) {
workdir = pw->pw_dir;
// If home dir is still not defined or set to nologin/nonexistent, fall back to /tmp
if (strstr(workdir, "nologin") || strstr(workdir, "nonexistent") || workdir == NULL || strlen(workdir) == 0) {
if (workdir == NULL || strlen(workdir) == 0 || strstr(workdir, "nologin") || strstr(workdir, "nonexistent")) {
workdir = "/tmp";
}