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

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

bug#13807: updated version to avoid MS-Windows vs non-MS-Windows clashes


From: Eli Zaretskii
Subject: bug#13807: updated version to avoid MS-Windows vs non-MS-Windows clashes
Date: Tue, 05 Mar 2013 20:38:02 +0200

> Date: Mon, 04 Mar 2013 18:25:32 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: monnier@iro.umontreal.ca, 13807@debbugs.gnu.org
> 
> > This will need a no-op emulation of fchmod for Windows (since a file
> > created here will be world-writable anyway).
> 
> OK, thanks.  Also, older POSIXish hosts that lack mkstemp won't need
> the fchmod either.  I added the following to try to address these two points.
> Revised complete patch attached, relative to trunk bzr 111938.

Thanks, I have 2 more nits.

> +  while ((nbytes = readlinkat (AT_FDCWD, lfname, lfinfo, MAX_LFINFO + 1)) < 0
> +      && errno == EINVAL)
>      {
> -      lfinfo[nbytes] = '\0';
> -      return build_string (lfinfo);
> +      int fd = emacs_open (lfname, O_RDONLY | O_BINARY | O_NOFOLLOW, 0);
> +      if (0 <= fd)
> +     {
> +       ptrdiff_t read_bytes = emacs_read (fd, lfinfo, MAX_LFINFO + 1);
> +       int read_errno = errno;
> +       if (emacs_close (fd) != 0)
> +         return -1;
> +       errno = read_errno;
> +       return read_bytes;
> +     }
> +
> +      if (errno != ELOOP)
> +     return -1;

We will need to define away O_NOFOLLOW and ELOOP, to get this to
compile on Windows.  I think the right place for the former is
nt/inc/unistd.h, near O_NOCTTY, and for the latter nt/inc/ms-w32.h,
where ENOTSUP is defined.

Other than that, I think this is OK.  Thanks.






reply via email to

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