Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 195977 | Differences between
and this patch

Collapse All | Expand All

(-)gpm-1.20.1/src/prog/gpm-root.y.openmax (-1 / +3 lines)
Lines 525-531 Link Here
525
	            open("/dev/null",O_RDONLY); /* stdin  */
525
	            open("/dev/null",O_RDONLY); /* stdin  */
526
	            open(consolename,O_WRONLY); /* stdout */
526
	            open(consolename,O_WRONLY); /* stdout */
527
	            dup(1);                     /* stderr */  
527
	            dup(1);                     /* stderr */  
528
	            for (i=3;i<OPEN_MAX; i++) close(i);
528
		    int open_max = sysconf(_SC_OPEN_MAX);
529
		    if (open_max == -1) open_max = 1024;
530
	            for (i=3;i<open_max; i++) close(i);
529
	            execl("/bin/sh","sh","-c",self->arg,(char *)NULL);
531
	            execl("/bin/sh","sh","-c",self->arg,(char *)NULL);
530
	            exit(1); /* shouldn't happen */
532
	            exit(1); /* shouldn't happen */
531
	         default: return 0;
533
	         default: return 0;
(-)gpm-1.20.1/src/special.c.openmax (-1 / +3 lines)
Lines 156-162 Link Here
156
      open(GPM_NULL_DEV,O_RDONLY); /* stdin  */
156
      open(GPM_NULL_DEV,O_RDONLY); /* stdin  */
157
      open(console.device, O_WRONLY); /* stdout */
157
      open(console.device, O_WRONLY); /* stdout */
158
      dup(1);                     /* stderr */
158
      dup(1);                     /* stderr */
159
      for (i=3;i<OPEN_MAX; i++) close(i);
159
      int open_max = sysconf(_SC_OPEN_MAX);
160
      if (open_max == -1) open_max = 1024;
161
      for (i=3;i<open_max; i++) close(i);
160
      execl("/bin/sh","sh","-c",command,(char *)NULL);
162
      execl("/bin/sh","sh","-c",command,(char *)NULL);
161
      exit(1); /* shouldn't happen */
163
      exit(1); /* shouldn't happen */

Return to bug 195977