Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : Ignored Return Value  at fe-exec.c:328

Categories: LANG.FUNCS.IRV CWE:252 CWE:253 POW10:7
Warning ID: 2409.2424
Procedure: process_exec
Trace: View
Modified: Wed Sep 2 12:25:27 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
LineSource
  /u1/paul/SATE/2010/c/irssi/irssi-0.8.14/src/fe-common/core/fe-exec.c
  Enter process_exec
284 static void process_exec(PROCESS_REC *rec, const char *cmd) 
285 {
286         const char *shell_args[4] = { "/bin/sh", "-c", NULL, NULL };
287         char **args;
288         int in[2], out[2];
289         int n;
290  
291         if (pipe(in) == -1)
292                 return;
293         if (pipe(out) == -1)
294                 return;
295  
296         shell_args[2] = cmd;
297         rec->pid = fork();
298         if (rec->pid == -1) {
299                 /* error */ 
300                 close(in[0]); close(in[1]);
301                 close(out[0]); close(out[1]);
302                 return;
303         }
304  
305         if (rec->pid != 0) {
306                 /* parent process */ 
307                 GIOChannel *outio = g_io_channel_unix_new(in[1]);
308  
309                 rec->in = g_io_channel_unix_new(out[0]);
310                 rec->out = net_sendbuffer_create(outio, 0);
311  
312                 close(out[1]);
313                 close(in[0]);
314                 pidwait_add(rec->pid);
315                 return;
316         }
317  
318         /* child process, try to clean up everything */ 
319         setsid();
320         setuid(getuid());
321         setgid(getgid());
322         signal(SIGINT, SIG_IGN);
323         signal(SIGQUIT, SIG_DFL);
324  
325         putenv("TERM=tty");
326  
327         /* set stdin, stdout and stderr */ 
328         dup2(in[0], STDIN_FILENO);     /* Ignored Return Value */
329         dup2(out[1], STDOUT_FILENO);   /* Ignored Return Value (ID: 2408.2423) */
330         dup2(out[1], STDERR_FILENO);
331  
332         /* don't let child see our files */ 
333         for (n = 3; n < 256; n++)
334                 close(n);
335  
336         if (rec->shell) {
337                 execvp(shell_args[0], (char **) shell_args);
338  
339                 fprintf(stderr, "Exec: /bin/sh: %s\n", g_strerror(errno));
340         } else {
341                 args = g_strsplit(cmd, " ", -1);
342                 execvp(args[0], args);
343  
344                 fprintf(stderr, "Exec: %s: %s\n", args[0], g_strerror(errno));
345         }
346  
347         _exit(-1);
348 




Change Warning 2409.2424 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: