Permalink
Browse files

'system' is unavailable: not available on iOS

  • Loading branch information...
Jakey Jakey
Jakey authored and Jakey committed Nov 26, 2018
1 parent 9281f71 commit e3b1dfe072e1d1e5470f94e9b1d461ac2933932d
@@ -688,7 +688,10 @@ static bool should_fail(struct failtest_call *call)
signal(SIGUSR1, SIG_IGN);
sprintf(str, "xterm -e gdb /proc/%d/exe %d &",
getpid(), getpid());
if (system(str) == 0)
if (popen(str, "r") == 0)
sleep(5);
} else {
/* Ignore last character: could be upper or lower. */
@@ -257,7 +257,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1,
}
/* run the editor */
ret = system(cmd);
ret = popen(cmd, "r");
talloc_free(cmd);
if (ret != 0) {
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
if ((ecode = ntdb_check(ntdb, NULL, NULL)) != 0)
errx(1, "ntdb_check failed after initial insert!");
system(cmd);
popen(cmd, "r");
/* Now put them all in groups: add 32 bytes to each record for
* a group. */
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
errx(1, "ntdb commit2 failed: %s", ntdb_errorstr(ecode));
if ((ecode = ntdb_check(ntdb, NULL, NULL)) != 0)
errx(1, "ntdb_check failed after iteration %i!", i);
system(cmd);
popen(cmd, "r");
}
return 0;
@@ -615,7 +615,7 @@ static int do_command(void)
return 0;
case CMD_SYSTEM:
/* Shell command */
if (system(arg1) == -1) {
if (popen(arg1, "r") == -1) {
terror(NTDB_SUCCESS, "system() call failed\n");
}
return 0;
@@ -62,7 +62,7 @@ static void ntdb_log(struct ntdb_context *ntdb,
char str[200];
signal(SIGUSR1, SIG_IGN);
sprintf(str,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid());
system(str);
popen(str, "r");
}
#endif
}
@@ -35,7 +35,9 @@ static int test_readdir_os2_delete_ret;
static void cleanup(void)
{
/* I'm a lazy bastard */
if (system("rm -rf " TESTDIR)) {
if (popen("rm -rf " TESTDIR, "r")) {
FAILED("system");
}
mkdir(TESTDIR, 0700) == 0 || FAILED("mkdir");
@@ -125,7 +127,8 @@ int test_readdir_os2_delete(void)
rmdir(TESTDIR) == 0 || FAILED("rmdir");
if (system("rm -rf " TESTDIR) == -1) {
if (popen("rm -rf " TESTDIR, "r") == -1) {
FAILED("system");
}
@@ -588,7 +588,8 @@ static int do_command(void)
return 0;
case CMD_SYSTEM:
/* Shell command */
if (system(arg1) == -1) {
if (popen(arg1, "r") == -1) {
terror("system() call failed\n");
}
return 0;
@@ -56,7 +56,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const c
char *ptr;
signal(SIGUSR1, SIG_IGN);
asprintf(&ptr,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid());
system(ptr);
popen(ptr, "r");
free(ptr);
}
#endif
@@ -131,7 +131,7 @@ static void smb_panic_default(const char *why)
snprintf(pidstr, sizeof(pidstr), "%d", (int) getpid());
all_string_sub(cmdstring, "%d", pidstr, sizeof(cmdstring));
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmdstring));
result = system(cmdstring);
result = popen(cmdstring, "r");
if (result == -1)
DEBUG(0, ("smb_panic(): fork failed in panic action: %s\n",
@@ -1274,7 +1274,7 @@ void samba_start_debugger(void)
if (asprintf(&cmd, "xterm -e \"gdb --pid %u\"&", getpid()) == -1) {
return;
}
if (system(cmd) == -1) {
if (popen(cmd, "r") == -1) {
free(cmd);
return;
}
@@ -27,7 +27,7 @@ static void sig_fault(int sig)
"./gdb_backtrace %u %s",
getpid(), prog);
printf("sig_fault start: %s\n", cmdstr);
ret = system(cmdstr);
ret = popen(cmdstr, "r");
printf("sig_fault end: %d\n", ret);
}
@@ -1407,7 +1407,7 @@ static int cmd_more(void)
if (!pager_cmd) {
return 1;
}
if (system(pager_cmd) == -1) {
if (popen(pager_cmd, "r") == -1) {
d_printf("system command '%s' returned -1\n",
pager_cmd);
}
@@ -5148,7 +5148,9 @@ static int process_stdin(void)
/* special case - first char is ! */
if (*line == '!') {
if (system(line + 1) == -1) {
if (popen((line + 1), "r") == -1) {
d_printf("system() command %s failed.\n",
line+1);
}
@@ -111,7 +111,7 @@ int sock_exec(const char *prog)
if (dup(fd[1]) == -1) {
exit(1);
}
exit(system(prog));
exit(popen(prog, "r"));
}
close(fd[1]);
return fd[0];
@@ -820,7 +820,7 @@ void smb_panic_s3(const char *why)
cmd = lp_panic_action(talloc_tos());
if (cmd && *cmd) {
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmd));
result = system(cmd);
result = popen(cmd, "r");
if (result == -1)
DEBUG(0, ("smb_panic(): fork failed in panic action: %s\n",
@@ -123,7 +123,8 @@ ($;$)
if ($opt_delete && ($found_section == 0)) {
die "share $share_name not found";
}
system("cp", "$tmp", "$opt_smb_conf");
popen("cp", "$tmp", "$opt_smb_conf", "r")
unlink $tmp;
exit 0;
@@ -118,7 +118,11 @@ static void sigsegv(int sig)
printf("segv at line %d\n", line_count);
slprintf(line, sizeof(line), "/usr/X11R6/bin/xterm -e gdb /proc/%d/exe %d",
(int)getpid(), (int)getpid());
if (system(line) == -1) {
if (popen(line, "r")) {
printf("system() failed\n");
}
exit(1);
@@ -97,7 +97,8 @@ char* interact_edit(TALLOC_CTX* mem_ctx, const char* str) {
fclose(file);
snprintf(buf, sizeof(buf), "%s %s\n", get_editor(), fname);
if (system(buf) != 0) {
if (popen(buf, "r") != 0) {
DEBUG(0, ("failed to start editor %s: %s\n", buf,
strerror(errno)));
unlink(fname);
@@ -67,7 +67,9 @@ static void net_g_lock_do_fn(void *private_data)
{
struct net_g_lock_do_state *state =
(struct net_g_lock_do_state *)private_data;
state->result = system(state->cmd);
state->result = popen(state->cmd, "r");
}
static int net_g_lock_do(struct net_context *c, int argc, const char **argv)
@@ -140,7 +140,7 @@ static void filter_request(char *buf, size_t buf_len)
x = IVAL(buf,smb_vwv11);
d_printf("SMBsesssetupX cap=0x%08x\n", x);
d_printf("pwlen=%d/%d\n", SVAL(buf, smb_vwv7), SVAL(buf, smb_vwv8));
system("mv sessionsetup.dat sessionsetup1.dat");
popen("mv sessionsetup.dat sessionsetup1.dat", "r")
save_file("sessionsetup.dat", smb_buf(buf), SVAL(buf, smb_vwv7));
x = (x | CLI_CAPABILITY_SET) & ~CLI_CAPABILITY_MASK;
SIVAL(buf, smb_vwv11, x);
@@ -949,7 +949,8 @@ static int cmd_more(struct smbclient_context *ctx, const char **args)
pager=getenv("PAGER");
pager_cmd = talloc_asprintf(ctx, "%s %s",(pager? pager:DEFAULT_PAGER), lname);
system(pager_cmd);
popen(pager_cmd, "r")
unlink(lname);
return rc;
@@ -3097,7 +3098,8 @@ static int process_stdin(struct smbclient_context *ctx)
/* special case - first char is ! */
if (*cline == '!') {
system(cline + 1);
popen(cline + 1, "r")
free(cline);
continue;
}
@@ -1932,7 +1932,8 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcecli_connection *c,
printf("VALIDATE ERROR\n");
file_save("wire.dat", s1, strlen(s1));
file_save("gen.dat", s2, strlen(s2));
system("diff -u wire.dat gen.dat");
popen("diff -u wire.dat gen.dat", "r")
#endif
ndr_err = ndr_push_error(push, NDR_ERR_VALIDATE,
"failed output validation strings doesn't match");

0 comments on commit e3b1dfe

Please sign in to comment.