Magellan Linux

Diff of /trunk/mkinitrd-magellan/klibc/usr/dash/input.c

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

revision 814 by niro, Sat Sep 1 22:45:15 2007 UTC revision 815 by niro, Fri Apr 24 18:32:46 2009 UTC
# Line 428  int Line 428  int
428  setinputfile(const char *fname, int flags)  setinputfile(const char *fname, int flags)
429  {  {
430   int fd;   int fd;
  int fd2;  
431    
432   INTOFF;   INTOFF;
433   if ((fd = open(fname, O_RDONLY)) < 0) {   if ((fd = open(fname, O_RDONLY)) < 0) {
# Line 436  setinputfile(const char *fname, int flag Line 435  setinputfile(const char *fname, int flag
435   goto out;   goto out;
436   sh_error("Can't open %s", fname);   sh_error("Can't open %s", fname);
437   }   }
438   if (fd < 10) {   if (fd < 10)
439   fd2 = copyfd(fd, 10);   fd = savefd(fd);
  close(fd);  
  if (fd2 < 0)  
  sh_error("Out of file descriptors");  
  fd = fd2;  
  }  
440   setinputfd(fd, flags & INPUT_PUSH_FILE);   setinputfd(fd, flags & INPUT_PUSH_FILE);
441  out:  out:
442   INTON;   INTON;
# Line 458  out: Line 452  out:
452  void  void
453  setinputfd(int fd, int push)  setinputfd(int fd, int push)
454  {  {
  (void) fcntl(fd, F_SETFD, FD_CLOEXEC);  
455   if (push) {   if (push) {
456   pushfile();   pushfile();
457   parsefile->buf = 0;   parsefile->buf = 0;

Legend:
Removed from v.814  
changed lines
  Added in v.815