commit - 8b2200400f8201d7fb3b5f0c2ebcfe85cbf0845a
commit + 8a08cb62d3b10a1f20aabb7976de5a2533b24cb5
blob - 89600edc8ee876fb09530238614b61afc9313a67
blob + fe2b5ddf378b416615554ecb25cad478695eae1e
--- vias.c
+++ vias.c
if ((tfd = mkstemp(tmpfile)) == -1)
err(1, "mkstemp failed");
-
- if (pledge("stdio rpath wpath cpath exec proc tty", NULL) == -1)
- err(1, "pledge");
-
- if (!fcpy(tfd, ofd)) {
- unlink(tmpfile);
- err(1, "temp copy failed");
- }
-
+ ttyfd = open("/dev/tty", O_RDWR | O_CLOFORK);
if (getcwd(cwdpath, sizeof(cwdpath)) == NULL)
cwd = "(failed)";
else
cwd = cwdpath;
- if (pledge("stdio rpath wpath cpath exec proc tty", NULL) == -1)
+ if (pledge("stdio cpath exec proc tty", NULL) == -1)
err(1, "pledge");
+ if (!fcpy(tfd, ofd)) {
+ unlink(tmpfile);
+ err(1, "temp copy failed");
+ }
+
syslog(LOG_AUTHPRIV | LOG_INFO, "%s edited %s from %s",
myname, file, cwd);
execvp(eargv[0], eargv);
err(1, "execvp failed");
default:
- if (pledge("stdio rpath wpath cpath proc tty", NULL) == -1)
- err(1, "pledge");
-
- (void)setpgid(vipid, 0);
- ttyfd = open("/dev/tty", O_RDWR);
if (pledge("stdio cpath proc tty", NULL) == -1)
err(1, "pledge");
+
+ (void)setpgid(vipid, 0);
if (ttyfd != -1)
(void)tcsetpgrp(ttyfd, vipid);
while ((ret = waitpid(vipid, &status, 0)) == -1 &&