bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF


From: Paul Eggert
Subject: Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF
Date: Fri, 16 Dec 2011 10:47:17 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0

On 12/16/11 05:46, Joachim Schmitz wrote:
> It is not O_NOCTTY or O_NONBLOCK and the others (O_SEARCH, O_DIRECTORY,
> O_NOFOLLOW, O_NOATIME) don't exist here.

It could be the FD_CLOEXEC, perhaps.  What does the following do?
Try it standalone, and also try it compiled and linked against
gnulib.


#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>

int main (void)
{
  int fd, r, fd2;
  fd = open (".", O_RDONLY | O_NOCTTY | O_NONBLOCK);
  if (fd < 0)
    return perror ("open"), 1;
  r = fcntl (fd, F_SETFD, FD_CLOEXEC);
  if (r < 0)
    return perror ("F_SETFD"), 1;
  fd2 = dup (fd);
  if (fd2 < 0)
    return perror ("dup"), 1;
  return 0;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]