239
Plugins/BuildFFmpeg/patch/libsmbclient/05-no_fork_and_exec.patch
Normal file
239
Plugins/BuildFFmpeg/patch/libsmbclient/05-no_fork_and_exec.patch
Normal file
@ -0,0 +1,239 @@
|
||||
--- a/lib/util/become_daemon.c
|
||||
+++ b/lib/util/become_daemon.c
|
||||
@@ -53,7 +53,7 @@
|
||||
{
|
||||
pid_t newpid;
|
||||
if (do_fork) {
|
||||
- newpid = fork();
|
||||
+ newpid = -1;
|
||||
if (newpid == -1) {
|
||||
exit_daemon("Fork failed", errno);
|
||||
}
|
||||
--- a/lib/util/fault.c
|
||||
+++ b/lib/util/fault.c
|
||||
@@ -150,7 +150,7 @@
|
||||
}
|
||||
|
||||
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmdstring));
|
||||
- result = system(cmdstring);
|
||||
+ result = -1;
|
||||
|
||||
if (result == -1)
|
||||
DEBUG(0, ("smb_panic(): fork failed in panic action: %s\n",
|
||||
--- a/lib/util/sys_popen.c
|
||||
+++ b/lib/util/sys_popen.c
|
||||
@@ -74,7 +74,7 @@
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
- entry->child_pid = fork();
|
||||
+ entry->child_pid = -1;
|
||||
|
||||
if (entry->child_pid == -1) {
|
||||
DBG_ERR("fork failed: %s\n", strerror(errno));
|
||||
@@ -105,7 +105,7 @@
|
||||
for (p = popen_chain; p; p = p->next)
|
||||
close(p->fd);
|
||||
|
||||
- ret = execv(argl[0], argl);
|
||||
+ ret = -1;
|
||||
if (ret == -1) {
|
||||
DBG_ERR("ERROR executing command "
|
||||
"'%s': %s\n", command, strerror(errno));
|
||||
--- a/lib/util/tfork.c
|
||||
+++ b/lib/util/tfork.c
|
||||
@@ -511,7 +511,7 @@
|
||||
ready_pipe_worker_fd = p[0];
|
||||
ready_pipe_caller_fd = p[1];
|
||||
|
||||
- pid = fork();
|
||||
+ pid = -1;
|
||||
if (pid == -1) {
|
||||
close(status_sp_caller_fd);
|
||||
close(status_sp_waiter_fd);
|
||||
@@ -580,7 +580,7 @@
|
||||
close(event_pipe_caller_fd);
|
||||
close(ready_pipe_caller_fd);
|
||||
|
||||
- pid = fork();
|
||||
+ pid = -1;
|
||||
if (pid == -1) {
|
||||
state->waiter_errno = errno;
|
||||
_exit(0);
|
||||
--- a/lib/util/util_runcmd.c
|
||||
+++ b/lib/util/util_runcmd.c
|
||||
@@ -261,7 +261,6 @@
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
- (void)execvp(state->arg0, argv);
|
||||
fprintf(stderr, "Failed to exec child - %s\n", strerror(errno));
|
||||
_exit(255);
|
||||
return NULL;
|
||||
--- a/source3/lib/background.c
|
||||
+++ b/source3/lib/background.c
|
||||
@@ -159,7 +159,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- res = fork();
|
||||
+ res = -1;
|
||||
if (res == -1) {
|
||||
int err = errno;
|
||||
close(fds[0]);
|
||||
--- a/source3/lib/server_prefork.c
|
||||
+++ b/source3/lib/server_prefork.c
|
||||
@@ -109,7 +109,7 @@
|
||||
pfp->pool[i].allowed_clients = 1;
|
||||
pfp->pool[i].started = now;
|
||||
|
||||
- pid = fork();
|
||||
+ pid = -1;
|
||||
switch (pid) {
|
||||
case -1:
|
||||
DEBUG(1, ("Failed to prefork child n. %d !\n", i));
|
||||
@@ -199,7 +199,7 @@
|
||||
pfp->pool[i].allowed_clients = 1;
|
||||
pfp->pool[i].started = now;
|
||||
|
||||
- pid = fork();
|
||||
+ pid = -1;
|
||||
switch (pid) {
|
||||
case -1:
|
||||
DEBUG(1, ("Failed to prefork child n. %d !\n", j));
|
||||
--- a/source3/lib/smbrun.c
|
||||
+++ b/source3/lib/smbrun.c
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
saved_handler = CatchChildLeaveStatus();
|
||||
|
||||
- if ((pid=fork()) < 0) {
|
||||
+ if ((pid=-1) < 0) {
|
||||
DEBUG(0,("smbrun: fork failed with error %s\n", strerror(errno) ));
|
||||
(void)CatchSignal(SIGCLD, saved_handler);
|
||||
if (outfd) {
|
||||
@@ -193,15 +193,6 @@
|
||||
exit(82);
|
||||
}
|
||||
|
||||
- if (env != NULL) {
|
||||
- execle("/bin/sh","sh","-c",
|
||||
- newcmd ? (const char *)newcmd : cmd, NULL,
|
||||
- env);
|
||||
- } else {
|
||||
- execl("/bin/sh","sh","-c",
|
||||
- newcmd ? (const char *)newcmd : cmd, NULL);
|
||||
- }
|
||||
-
|
||||
SAFE_FREE(newcmd);
|
||||
}
|
||||
|
||||
@@ -263,7 +254,7 @@
|
||||
|
||||
saved_handler = CatchChildLeaveStatus();
|
||||
|
||||
- if ((pid=fork()) < 0) {
|
||||
+ if ((pid=-1) < 0) {
|
||||
DEBUG(0, ("smbrunsecret: fork failed with error %s\n", strerror(errno)));
|
||||
(void)CatchSignal(SIGCLD, saved_handler);
|
||||
return errno;
|
||||
@@ -346,8 +333,6 @@
|
||||
2 point to /dev/null from the startup code */
|
||||
closefrom(3);
|
||||
|
||||
- execl("/bin/sh", "sh", "-c", cmd, NULL);
|
||||
-
|
||||
/* not reached */
|
||||
exit(82);
|
||||
return 1;
|
||||
--- a/source3/lib/util.c
|
||||
+++ b/source3/lib/util.c
|
||||
@@ -695,7 +695,7 @@
|
||||
cmd = lp_panic_action(talloc_tos(), lp_sub);
|
||||
if (cmd && *cmd) {
|
||||
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmd));
|
||||
- result = system(cmd);
|
||||
+ result = -1;
|
||||
|
||||
if (result == -1)
|
||||
DEBUG(0, ("smb_panic(): fork failed in panic action: %s\n",
|
||||
--- a/source4/heimdal/lib/roken/simple_exec.c
|
||||
+++ b/source4/heimdal/lib/roken/simple_exec.c
|
||||
@@ -155,7 +155,7 @@
|
||||
pipe(out_fd);
|
||||
if(stderr_fd != NULL)
|
||||
pipe(err_fd);
|
||||
- pid = fork();
|
||||
+ pid = -1;
|
||||
switch(pid) {
|
||||
case 0:
|
||||
va_start(ap, file);
|
||||
@@ -196,7 +196,6 @@
|
||||
|
||||
closefrom(3);
|
||||
|
||||
- execv(file, argv);
|
||||
exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
|
||||
case -1:
|
||||
if(stdin_fd != NULL) {
|
||||
@@ -233,12 +232,11 @@
|
||||
simple_execvp_timed(const char *file, char *const args[],
|
||||
time_t (*func)(void *), void *ptr, time_t timeout)
|
||||
{
|
||||
- pid_t pid = fork();
|
||||
+ pid_t pid = -1;
|
||||
switch(pid){
|
||||
case -1:
|
||||
return SE_E_FORKFAILED;
|
||||
case 0:
|
||||
- execvp(file, args);
|
||||
exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
|
||||
default:
|
||||
return wait_for_process_timed(pid, func, ptr, timeout);
|
||||
@@ -256,12 +254,11 @@
|
||||
simple_execve_timed(const char *file, char *const args[], char *const envp[],
|
||||
time_t (*func)(void *), void *ptr, time_t timeout)
|
||||
{
|
||||
- pid_t pid = fork();
|
||||
+ pid_t pid = -1;
|
||||
switch(pid){
|
||||
case -1:
|
||||
return SE_E_FORKFAILED;
|
||||
case 0:
|
||||
- execve(file, args, envp);
|
||||
exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
|
||||
default:
|
||||
return wait_for_process_timed(pid, func, ptr, timeout);
|
||||
--- a/source4/libcli/resolve/dns_ex.c
|
||||
+++ b/source4/libcli/resolve/dns_ex.c
|
||||
@@ -620,7 +620,7 @@
|
||||
}
|
||||
tevent_fd_set_auto_close(state->fde);
|
||||
|
||||
- state->child = fork();
|
||||
+ state->child = -1;
|
||||
if (state->child == (pid_t)-1) {
|
||||
composite_error(c, map_nt_error_from_unix_common(errno));
|
||||
return c;
|
||||
--- a/tests/fcntl_lock.c
|
||||
+++ b/tests/fcntl_lock.c
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
alarm(10);
|
||||
|
||||
- if (!(pid=fork())) {
|
||||
+ if (!(pid=-1)) {
|
||||
sleep(2);
|
||||
fd = open(DATA, O_RDONLY);
|
||||
|
||||
--- a/third_party/popt/popt.c
|
||||
+++ b/third_party/popt/popt.c
|
||||
@@ -562,7 +562,7 @@
|
||||
#endif
|
||||
|
||||
/*@-nullstate@*/
|
||||
- rc = execvp(argv[0], (char *const *)argv);
|
||||
+ rc = -1;
|
||||
/*@=nullstate@*/
|
||||
|
||||
exit:
|
||||
Reference in New Issue
Block a user