unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 13807@debbugs.gnu.org
Subject: bug#13807: updated version to avoid MS-Windows vs non-MS-Windows clashes
Date: Tue, 05 Mar 2013 20:38:02 +0200	[thread overview]
Message-ID: <834ngp3d6d.fsf@gnu.org> (raw)
In-Reply-To: <5135579C.400@cs.ucla.edu>

> 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	other threads:[~2013-03-05 18:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24 22:48 bug#13807: The lock for 'DIR/FILE' should always be 'DIR/.#FILE' Paul Eggert
2013-02-25 19:57 ` Glenn Morris
2013-02-25 23:40   ` Paul Eggert
2013-02-26 22:19 ` bug#13807: updated version to avoid MS-Windows vs non-MS-Windows clashes Paul Eggert
2013-02-27 18:49   ` Eli Zaretskii
2013-03-02 20:43     ` Paul Eggert
2013-03-02 21:17       ` Eli Zaretskii
2013-03-02 22:37         ` Paul Eggert
2013-03-03 16:39           ` Eli Zaretskii
2013-03-03 23:56             ` Paul Eggert
2013-03-04 16:50               ` Eli Zaretskii
2013-03-05  2:25                 ` Paul Eggert
2013-03-05 18:38                   ` Eli Zaretskii [this message]
2013-03-05 22:38                     ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834ngp3d6d.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=13807@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).