At Wed, 27 Jun 2007 06:15:56 +0900,
Junichi Uekawa wrote:
> 
> Hi,
> 
> > > close(1023)                             = -1 EBADF (Bad file descriptor)
> > > close(1022)                             = -1 EBADF (Bad file descriptor)
> > > close(1021)                             = -1 EBADF (Bad file descriptor)
> > > close(1020)                             = -1 EBADF (Bad file descriptor)
> >     .
> >     .
> >     .
> > > close(6)                                = -1 EBADF (Bad file descriptor)
> > > close(5)                                = 0
> > > close(4)                                = 0
> > > close(3)                                = 0
> > 
> > Hmm.... who's doing this ?
> 
> Looking at source, tar calls 'closeopen', which does exactly this.
> According to ChangeLog, it was probably changed for 1.16.  Looking at
> http://packages.qa.debian.org/t/tar.html, it was released October
> 2006.  I wonder why it didn't break before.

Hmmm.. mmap shouldn't break with fds being closed randomly.  On the
other hand, people randomly writing to the fd might be bad. I'll try
with closing file descriptor for a change.



I suspect the following code as well, but my test code seems to work
fine.




sys_exec_info_script (const char **archive_name, int volume_number)

  xclose (p[PREAD]);
  xdup2 (p[PWRITE], 3);

  argv[0] = "/bin/sh";
  argv[1] = "-c";
  argv[2] = (char*) info_script_option;
  argv[3] = NULL;

  execv (argv[0], argv);

  exec_fatal (info_script_option);
}


2005-12-07  Sergey Poznyakoff  <[EMAIL PROTECTED]>

        * src/common.h (sys_exec_info_script): Update declaration
        (restrict_option): New global
        * src/system.c (sys_exec_info_script): The script can supply new
        archive name to use by writing it to file descriptor 3.




regards,
        junichi
-- 
[EMAIL PROTECTED],netfort.gr.jp}   Debian Project


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to