/[path-sandbox]/trunk/src/sandbox.c
Gentoo

Diff of /trunk/src/sandbox.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 83 Revision 84
351 return 1; 351 return 1;
352} 352}
353 353
354int spawn_shell(char *argv_bash[]) 354int spawn_shell(char *argv_bash[])
355{ 355{
356#ifdef USE_SYSTEM_SHELL
357 int i = 0;
358 char *sh = NULL;
359 int first = 1;
360 int ret;
361 long len = 0;
362
363 while (1) {
364 if (NULL == argv_bash[i])
365 break;
366 if (NULL != sh)
367 len = strlen(sh);
368 sh = (char *)realloc(sh, len + strlen(argv_bash[i]) + 5);
369 if (first) {
370 sh[0] = 0;
371 first = 0;
372 }
373 strcat(sh, "\"");
374 strcat(sh, argv_bash[i]);
375 strcat(sh, "\" ");
376
377 //printf("%s\n", argv_bash[i]);
378 i++;
379 }
380 printf("%s\n", sh);
381 ret = system(sh);
382 if (sh)
383 free(sh);
384 sh = NULL;
385
386 if (-1 == ret)
387 return 0;
388 return 1;
389
390#else
391# ifndef NO_FORK 356# ifndef NO_FORK
392 int pid; 357 int pid;
393 int status = 0; 358 int status = 0;
394 int ret = 0; 359 int ret = 0;
395 360

Legend:
Removed from v.83  
changed lines
  Added in v.84

  ViewVC Help
Powered by ViewVC 1.1.20