the current scp code calls fork() in do_local_cmd() and it uses exit() even when vfork-ed. this patch fixes both issues. -mike
signature.asc
Description: This is a digitally signed message part.
#
# old_revision [2f31bc0e5d1c701ad8c03176bbb5722852c0c11d]
#
# patch "scp.c"
# from [a490c2773b48cbdb1ec1fa12f312bb8d98092f12]
# to [c9ced325688624015d7202aa1ef4bb2cf95cbfd9]
#
============================================================
--- scp.c a490c2773b48cbdb1ec1fa12f312bb8d98092f12
+++ scp.c c9ced325688624015d7202aa1ef4bb2cf95cbfd9
@@ -130,13 +130,22 @@ do_local_cmd(arglist *a)
fprintf(stderr, " %s", a->list[i]);
fprintf(stderr, "\n");
}
- if ((pid = fork()) == -1)
+#ifdef __uClinux__
+ pid = vfork();
+#else
+ pid = fork();
+#endif /* __uClinux__ */
+ if (pid == -1)
fatal("do_local_cmd: fork: %s", strerror(errno));
if (pid == 0) {
execvp(a->list[0], a->list);
perror(a->list[0]);
+#ifdef __uClinux__
+ _exit(1);
+#else
exit(1);
+#endif /* __uClinux__ */
}
do_cmd_pid = pid;
@@ -225,7 +234,11 @@ do_cmd(char *host, char *remuser, char *
execvp(ssh_program, args.list);
perror(ssh_program);
+#ifdef __uClinux__
+ _exit(1);
+#else
exit(1);
+#endif /* __uClinux__ */
} else if (do_cmd_pid == -1) {
fatal("fork: %s", strerror(errno));
}
