commit a9c88ec161ce482fe271ea4f16f35014b068a7f0
parent 3b509bb7bad40a8ad19ffae3520debd61b213f13
Author: Claudio Alessi <smoppy@gmail.com>
Date: Tue, 26 Apr 2016 20:43:06 +0200
Restore setsid(), it's the right way to spawn.
This introduces a little glitch about resizing the editor.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/myadm.c b/myadm.c
@@ -296,16 +296,16 @@ editbuf(char *in, int len, int *sz) {
if(fd == -1)
return NULL;
close(fd);
-
- a.v = (const char*[]){"/bin/sh", "-c", "$EDITOR \"$0\"", tmp, NULL};
if(fput(tmp, in, len) == -1) {
unlink(tmp);
return NULL;
}
+ a.v = (const char*[]){"/bin/sh", "-c", "$EDITOR \"$0\"", tmp, NULL};
ui_end();
spawn(&a);
while(wait(NULL) == -1);
ui_init();
+ ui_redraw();
buf = fget(tmp, sz);
unlink(tmp);
return buf;
@@ -713,7 +713,7 @@ setup(void) {
void
spawn(const Arg *arg) {
if(!fork()) {
- //setsid();
+ setsid();
execvp(((char **)arg->v)[0], (char **)arg->v);
fprintf(stderr, "myadm: execvp %s", ((char **)arg->v)[0]);
perror(" failed");