Fix pr#256 pledge() too early.

expand_tilde() may be called multiple times.
This commit is contained in:
Reginald Kennedy 2019-12-19 19:52:28 +08:00
parent a86f709be2
commit 3d694d8354

View file

@ -1432,9 +1432,6 @@ expand_tilde(const char *s)
ppwd = strlen(user) == 0 ? getpwuid(getuid()) : getpwnam(user);
free(user);
if (pledge("stdio proc exec rpath", NULL) == -1)
err(1, "pledge");
if (ppwd == NULL)
result = strdup(sc);
else
@ -13327,6 +13324,9 @@ main(int argc, char *argv[])
scan_config();
if (pledge("stdio proc exec rpath", NULL) == -1)
err(1, "pledge");
validate_spawns();
if (getenv("SWM_STARTED") == NULL)