bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: uudecode bug (?)


From: Paul Jarc
Subject: Re: uudecode bug (?)
Date: Mon, 10 Jun 2002 14:11:58 -0400
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i686-pc-linux-gnu)

Andrew D Jewell <address@hidden> wrote:
> -P, --paranoid : always open output files with
>                   "unlink(foo); open(foo, O_EXCL | O_CREATE)"

That loses mode bits.  Instead:
  fd=open(file, O_WRONLY|O_CREAT|O_NOFOLLOW);
  fstat(fd, &statbuf);
  if (!S_ISREG(statbuf.st_mode)) {
    close(fd);
    fail();
  }
O_NOFOLLOW might not exist on some systems, but then it's impossible
to completely avoid a race anyway, I think.


paul



reply via email to

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