Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
e1b01a3a
Commit
e1b01a3a
authored
Dec 17, 2011
by
Ken Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/fileio.c (check_writable) [CYGWIN]: Return non-zero if UID or
GID is unknown (Bug#10257).
parent
e1fefc61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
src/ChangeLog
src/ChangeLog
+5
-0
src/fileio.c
src/fileio.c
+15
-3
No files found.
src/ChangeLog
View file @
e1b01a3a
2011-12-17 Ken Brown <kbrown@cornell.edu>
* fileio.c (check_writable) [CYGWIN]: Return non-zero if UID or
GID is unknown (Bug#10257).
2011-12-17 Paul Eggert <eggert@cs.ucla.edu>
* s/gnu-linux.h: Fix mark_memory typo (Bug#10286).
...
...
src/fileio.c
View file @
e1b01a3a
...
...
@@ -2416,15 +2416,27 @@ check_writable (const char *filename)
return
(
st
.
st_mode
&
S_IWRITE
||
S_ISDIR
(
st
.
st_mode
));
#else
/* not MSDOS */
#ifdef HAVE_EUIDACCESS
return
(
euidaccess
(
filename
,
2
)
>=
0
);
#else
int
res
=
(
euidaccess
(
filename
,
2
)
>=
0
);
#ifdef CYGWIN
/* euidaccess may have returned failure because Cygwin couldn't
determine the file's UID or GID; if so, we return success. */
if
(
!
res
)
{
struct
stat
st
;
if
(
stat
(
filename
,
&
st
)
<
0
)
return
0
;
res
=
(
st
.
st_uid
==
-
1
||
st
.
st_gid
==
-
1
);
}
#endif
/* CYGWIN */
return
res
;
#else
/* not HAVE_EUIDACCESS */
/* Access isn't quite right because it uses the real uid
and we really want to test with the effective uid.
But Unix doesn't give us a right way to do it.
Opening with O_WRONLY could work for an ordinary file,
but would lose for directories. */
return
(
access
(
filename
,
2
)
>=
0
);
#endif
#endif
/* not HAVE_EUIDACCESS */
#endif
/* not MSDOS */
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment