mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 20:39:33 +08:00
* path.cc (cygwin_conv_path): Define tp before setting up faul handler.
* syscalls.cc: Ditto, throughout. (gen_full_path_at): Add bool parameter to allow NULL pathname. (futimesat): Allow NULL pathname as GLIBC.
This commit is contained in:
parent
ae47b14a12
commit
b72918135c
@ -1,3 +1,10 @@
|
||||
2008-05-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* path.cc (cygwin_conv_path): Define tp before setting up faul handler.
|
||||
* syscalls.cc: Ditto, throughout.
|
||||
(gen_full_path_at): Add bool parameter to allow NULL pathname.
|
||||
(futimesat): Allow NULL pathname as GLIBC.
|
||||
|
||||
2008-05-21 Christopher Faylor <me+cygwin@cgf.cx>
|
||||
|
||||
* string.h (strchr): Eliminate.
|
||||
|
@ -2799,12 +2799,12 @@ extern "C" ssize_t
|
||||
cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||
size_t size)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
|
||||
path_conv p;
|
||||
tmp_pathbuf tp;
|
||||
size_t lsiz = 0;
|
||||
char *buf = NULL;
|
||||
int error = 0;
|
||||
@ -2935,11 +2935,11 @@ realpath (const char *path, char *resolved)
|
||||
|
||||
/* Guard reading from a potentially invalid path and writing to a
|
||||
potentially invalid resolved. */
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return NULL;
|
||||
|
||||
tmp_pathbuf tp;
|
||||
char *tpath;
|
||||
if (isdrive (path))
|
||||
{
|
||||
|
@ -3567,8 +3567,18 @@ pclose (FILE *fp)
|
||||
/* Preliminary(?) implementation of the openat family of functions. */
|
||||
|
||||
static int
|
||||
gen_full_path_at (char *path_ret, int dirfd, const char *pathname)
|
||||
gen_full_path_at (char *path_ret, int dirfd, const char *pathname,
|
||||
bool null_pathname_allowed = false)
|
||||
{
|
||||
/* Set null_pathname_allowed to true to allow GLIBC compatible behaviour
|
||||
for NULL pathname. Only used by futimesat. */
|
||||
if (!pathname && !null_pathname_allowed)
|
||||
{
|
||||
set_errno (EFAULT);
|
||||
return -1;
|
||||
}
|
||||
if (pathname)
|
||||
{
|
||||
if (!*pathname)
|
||||
{
|
||||
set_errno (ENOENT);
|
||||
@ -3579,7 +3589,8 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname)
|
||||
set_errno (ENAMETOOLONG);
|
||||
return -1;
|
||||
}
|
||||
if (isdirsep (*pathname))
|
||||
}
|
||||
if (pathname && isdirsep (*pathname))
|
||||
stpcpy (path_ret, pathname);
|
||||
else
|
||||
{
|
||||
@ -3604,20 +3615,23 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname)
|
||||
set_errno (ENOTDIR);
|
||||
return -1;
|
||||
}
|
||||
if (pathname)
|
||||
{
|
||||
if (p[-1] != '/')
|
||||
*p++ = '/';
|
||||
stpcpy (p, pathname);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
openat (int dirfd, const char *pathname, int flags, ...)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3634,12 +3648,12 @@ openat (int dirfd, const char *pathname, int flags, ...)
|
||||
extern "C" int
|
||||
faccessat (int dirfd, const char *pathname, int mode, int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
|
||||
int res = -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (!gen_full_path_at (path, dirfd, pathname))
|
||||
{
|
||||
@ -3665,10 +3679,10 @@ faccessat (int dirfd, const char *pathname, int mode, int flags)
|
||||
extern "C" int
|
||||
fchmodat (int dirfd, const char *pathname, mode_t mode, int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3679,10 +3693,10 @@ extern "C" int
|
||||
fchownat (int dirfd, const char *pathname, __uid32_t uid, __gid32_t gid,
|
||||
int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3693,10 +3707,10 @@ fchownat (int dirfd, const char *pathname, __uid32_t uid, __gid32_t gid,
|
||||
extern "C" int
|
||||
fstatat (int dirfd, const char *pathname, struct __stat64 *st, int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3709,10 +3723,10 @@ extern "C" int
|
||||
utimensat (int dirfd, const char *pathname, const struct timespec *times,
|
||||
int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3725,12 +3739,12 @@ utimensat (int dirfd, const char *pathname, const struct timespec *times,
|
||||
extern "C" int
|
||||
futimesat (int dirfd, const char *pathname, const struct timeval *times)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
if (gen_full_path_at (path, dirfd, pathname, true))
|
||||
return -1;
|
||||
return utimes (path, times);
|
||||
}
|
||||
@ -3740,10 +3754,10 @@ linkat (int olddirfd, const char *oldpathname,
|
||||
int newdirfd, const char *newpathname,
|
||||
int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *oldpath = tp.c_get ();
|
||||
if (gen_full_path_at (oldpath, olddirfd, oldpathname))
|
||||
return -1;
|
||||
@ -3766,10 +3780,10 @@ linkat (int olddirfd, const char *oldpathname,
|
||||
extern "C" int
|
||||
mkdirat (int dirfd, const char *pathname, mode_t mode)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3779,10 +3793,10 @@ mkdirat (int dirfd, const char *pathname, mode_t mode)
|
||||
extern "C" int
|
||||
mkfifoat (int dirfd, const char *pathname, mode_t mode)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3792,10 +3806,10 @@ mkfifoat (int dirfd, const char *pathname, mode_t mode)
|
||||
extern "C" int
|
||||
mknodat (int dirfd, const char *pathname, mode_t mode, __dev32_t dev)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3805,10 +3819,10 @@ mknodat (int dirfd, const char *pathname, mode_t mode, __dev32_t dev)
|
||||
extern "C" ssize_t
|
||||
readlinkat (int dirfd, const char *pathname, char *buf, size_t bufsize)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
@ -3819,10 +3833,10 @@ extern "C" int
|
||||
renameat (int olddirfd, const char *oldpathname,
|
||||
int newdirfd, const char *newpathname)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *oldpath = tp.c_get ();
|
||||
if (gen_full_path_at (oldpath, olddirfd, oldpathname))
|
||||
return -1;
|
||||
@ -3835,10 +3849,10 @@ renameat (int olddirfd, const char *oldpathname,
|
||||
extern "C" int
|
||||
symlinkat (const char *oldpath, int newdirfd, const char *newpathname)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *newpath = tp.c_get ();
|
||||
if (gen_full_path_at (newpath, newdirfd, newpathname))
|
||||
return -1;
|
||||
@ -3848,10 +3862,10 @@ symlinkat (const char *oldpath, int newdirfd, const char *newpathname)
|
||||
extern "C" int
|
||||
unlinkat (int dirfd, const char *pathname, int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
return -1;
|
||||
tmp_pathbuf tp;
|
||||
char *path = tp.c_get ();
|
||||
if (gen_full_path_at (path, dirfd, pathname))
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user