Remove unneeded whitespace.

* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be set to
ENXIO when opening a fifo write/nonblocking.
* environ.cc (ucreqenv): Rename to ucenv.  Move code from old ucenv here and
conditionalize it on create_upcaseenv.
(ucenv): Delete.
(environ_init): Fix compiler warning by moving create_upcaseenv test to ucenv.
Don't bother checking for child_proc_info when calling ucenv since it is
assumed to be NULL at the point where the function is called.
* path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing with
devices since the device handler passes in a translated MS-DOS path.
* sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which causes a
compiler error.
* fhandler_netdrive.cc: Update copyright.
This commit is contained in:
Christopher Faylor 2008-11-26 17:21:04 +00:00
parent f43f75a09d
commit 025c1fac6e
21 changed files with 242 additions and 196 deletions

View File

@ -1,3 +1,27 @@
2008-11-26 Christopher Faylor <me+cygwin@cgf.cx>
Remove unneeded whitespace.
* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be
set to ENXIO when opening a fifo write/nonblocking.
* environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv
here and conditionalize it on create_upcaseenv.
(ucenv): Delete.
(environ_init): Fix compiler warning by moving create_upcaseenv test to
ucenv. Don't bother checking for child_proc_info when calling ucenv
since it is assumed to be NULL at the point where the function is
called.
* path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing
with devices since the device handler passes in a translated MS-DOS
path.
* sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which
causes a compiler error.
* fhandler_netdrive.cc: Update copyright.
2008-11-26 Corinna Vinschen <corinna@vinschen.de> 2008-11-26 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in (DLL_OFILES): Add setlsapwd.o. * Makefile.in (DLL_OFILES): Add setlsapwd.o.

View File

@ -437,53 +437,36 @@ unsetenv (const char *name)
return 0; return 0;
} }
/* Turn environment variable part of a=b string into uppercase. */
static __inline__ void
ucenv (char *p, char *eq)
{
/* Amazingly, NT has a case sensitive environment name list,
but only sometimes.
It's normal to have NT set your "Path" to something.
Later, you set "PATH" to something else. This alters "Path".
But if you try and do a naive getenv on "PATH" you'll get nothing.
So we upper case the labels here to prevent confusion later but
we only do it for the first process in a session group. */
for (; p < eq; p++)
if (islower (*p))
*p = cyg_toupper (*p);
}
/* Minimal list of Windows vars which must be converted to uppercase. /* Minimal list of Windows vars which must be converted to uppercase.
Either for POSIX compatibility of for backward compatibility with Either for POSIX compatibility of for backward compatibility with
existing applications. */ existing applications. */
static struct renv { static struct renv {
const char *name; const char *name;
const size_t namelen; const size_t namelen;
} renv_arr[] = { } renv_arr[] = {
{ NL("ALLUSERSPROFILE=") }, // 0 { NL("ALLUSERSPROFILE=") }, // 0
{ NL("COMMONPROGRAMFILES=") }, // 1 { NL("COMMONPROGRAMFILES=") }, // 1
{ NL("COMPUTERNAME=") }, { NL("COMPUTERNAME=") },
{ NL("COMSPEC=") }, { NL("COMSPEC=") },
{ NL("HOME=") }, // 4 { NL("HOME=") }, // 4
{ NL("HOMEDRIVE=") }, { NL("HOMEDRIVE=") },
{ NL("HOMEPATH=") }, { NL("HOMEPATH=") },
{ NL("NUMBER_OF_PROCESSORS=") }, // 7 { NL("NUMBER_OF_PROCESSORS=") }, // 7
{ NL("OS=") }, // 8 { NL("OS=") }, // 8
{ NL("PATH=") }, // 9 { NL("PATH=") }, // 9
{ NL("PATHEXT=") }, { NL("PATHEXT=") },
{ NL("PROCESSOR_ARCHITECTURE=") }, { NL("PROCESSOR_ARCHITECTURE=") },
{ NL("PROCESSOR_IDENTIFIER=") }, { NL("PROCESSOR_IDENTIFIER=") },
{ NL("PROCESSOR_LEVEL=") }, { NL("PROCESSOR_LEVEL=") },
{ NL("PROCESSOR_REVISION=") }, { NL("PROCESSOR_REVISION=") },
{ NL("PROGRAMFILES=") }, { NL("PROGRAMFILES=") },
{ NL("SYSTEMDRIVE=") }, // 16 { NL("SYSTEMDRIVE=") }, // 16
{ NL("SYSTEMROOT=") }, { NL("SYSTEMROOT=") },
{ NL("TEMP=") }, // 18 { NL("TEMP=") }, // 18
{ NL("TERM=") }, { NL("TERM=") },
{ NL("TMP=") }, { NL("TMP=") },
{ NL("TMPDIR=") }, { NL("TMPDIR=") },
{ NL("WINDIR=") } // 22 { NL("WINDIR=") } // 22
}; };
#define RENV_SIZE (sizeof (renv_arr) / sizeof (renv_arr[0])) #define RENV_SIZE (sizeof (renv_arr) / sizeof (renv_arr[0]))
/* Set of first characters of the above list of variables. */ /* Set of first characters of the above list of variables. */
@ -492,22 +475,41 @@ static const char idx_arr[] = "ACHNOPSTW";
starts. */ starts. */
static const int start_at[] = { 0, 1, 4, 7, 8, 9, 16, 18, 22 }; static const int start_at[] = { 0, 1, 4, 7, 8, 9, 16, 18, 22 };
/* Hopefully as quick as possible. Only upcase specific set of important /* Turn environment variable part of a=b string into uppercase.
Windows variables. */ Conditionally controlled by upcaseenv CYGWIN setting. */
static __inline__ void static __inline__ void
ucreqenv (char *p) ucenv (char *p, const char *eq)
{ {
char first = cyg_toupper (*p); if (create_upcaseenv)
const char *idx = strchr (idx_arr, first); {
if (idx) /* Amazingly, NT has a case sensitive environment name list,
for (size_t i = start_at[idx - idx_arr]; but only sometimes.
i < RENV_SIZE && renv_arr[i].name[0] == first; It's normal to have NT set your "Path" to something.
++i) Later, you set "PATH" to something else. This alters "Path".
if (strncasematch (p, renv_arr[i].name, renv_arr[i].namelen)) But if you try and do a naive getenv on "PATH" you'll get nothing.
{
strncpy (p, renv_arr[i].name, renv_arr[i].namelen); So we upper case the labels here to prevent confusion later but
break; we only do it for processes that are started by non-Cygwin programs. */
} for (; p < eq; p++)
if (islower (*p))
*p = cyg_toupper (*p);
}
else
{
/* Hopefully as quickly as possible - only upcase specific set of important
Windows variables. */
char first = cyg_toupper (*p);
const char *idx = strchr (idx_arr, first);
if (idx)
for (size_t i = start_at[idx - idx_arr];
i < RENV_SIZE && renv_arr[i].name[0] == first;
++i)
if (strncasematch (p, renv_arr[i].name, renv_arr[i].namelen))
{
strncpy (p, renv_arr[i].name, renv_arr[i].namelen);
break;
}
}
} }
/* Parse CYGWIN options */ /* Parse CYGWIN options */
@ -847,14 +849,10 @@ environ_init (char **envp, int envc)
if (*newp == '=') if (*newp == '=')
*newp = '!'; *newp = '!';
char *eq = strechr (newp, '='); char *eq = strechr (newp, '=');
if (!child_proc_info) ucenv (newp, eq); /* (possibly conditionally) uppercase env vars. */
if (create_upcaseenv)
ucenv (newp, eq); /* Uppercase all env vars. */
else
ucreqenv (newp); /* Uppercase only selected vars. */
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0) if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
sawTERM = 1; sawTERM = 1;
if (*eq && conv_start_chars[(unsigned char)envp[i][0]]) if (*eq && conv_start_chars[(unsigned char) envp[i][0]])
posify (envp + i, *++eq ? eq : --eq, tmpbuf); posify (envp + i, *++eq ? eq : --eq, tmpbuf);
debug_printf ("%p: %s", envp[i], envp[i]); debug_printf ("%p: %s", envp[i], envp[i]);
} }

View File

@ -46,9 +46,9 @@ fcntl64 (int fd, int cmd, ...)
case F_SETLK: case F_SETLK:
case F_SETLKW: case F_SETLKW:
{ {
struct __flock64 *fl = (struct __flock64 *) arg; struct __flock64 *fl = (struct __flock64 *) arg;
fl->l_type &= F_RDLCK | F_WRLCK | F_UNLCK; fl->l_type &= F_RDLCK | F_WRLCK | F_UNLCK;
res = cfd->lock (cmd, fl); res = cfd->lock (cmd, fl);
} }
break; break;
default: default:

View File

@ -524,11 +524,11 @@ fhandler_base::open (int flags, mode_t mode)
if (query_open () && pc.fs_is_nfs ()) if (query_open () && pc.fs_is_nfs ())
{ {
/* Make sure we can read EAs of files on an NFS share. Also make /* Make sure we can read EAs of files on an NFS share. Also make
sure that we're going to act on the file itself, even if it'a sure that we're going to act on the file itself, even if it'a
a symlink. */ a symlink. */
access |= FILE_READ_EA; access |= FILE_READ_EA;
if (query_open () >= query_write_control) if (query_open () >= query_write_control)
access |= FILE_WRITE_EA; access |= FILE_WRITE_EA;
plen = sizeof nfs_aol_ffei; plen = sizeof nfs_aol_ffei;
p = (PFILE_FULL_EA_INFORMATION) &nfs_aol_ffei; p = (PFILE_FULL_EA_INFORMATION) &nfs_aol_ffei;
} }
@ -583,7 +583,7 @@ fhandler_base::open (int flags, mode_t mode)
else if (pc.fs_is_nfs ()) else if (pc.fs_is_nfs ())
{ {
/* When creating a file on an NFS share, we have to set the /* When creating a file on an NFS share, we have to set the
file mode by writing a NFS fattr3 structure with the file mode by writing a NFS fattr3 structure with the
correct mode bits set. */ correct mode bits set. */
access |= FILE_WRITE_EA; access |= FILE_WRITE_EA;
plen = sizeof (FILE_FULL_EA_INFORMATION) + sizeof (NFS_V3_ATTR) plen = sizeof (FILE_FULL_EA_INFORMATION) + sizeof (NFS_V3_ATTR)
@ -595,7 +595,7 @@ fhandler_base::open (int flags, mode_t mode)
p->EaValueLength = sizeof (fattr3); p->EaValueLength = sizeof (fattr3);
strcpy (p->EaName, NFS_V3_ATTR); strcpy (p->EaName, NFS_V3_ATTR);
fattr3 *nfs_attr = (fattr3 *) (p->EaName fattr3 *nfs_attr = (fattr3 *) (p->EaName
+ p->EaNameLength + 1); + p->EaNameLength + 1);
memset (nfs_attr, 0, sizeof (fattr3)); memset (nfs_attr, 0, sizeof (fattr3));
nfs_attr->type = NF3REG; nfs_attr->type = NF3REG;
nfs_attr->mode = mode; nfs_attr->mode = mode;
@ -1609,7 +1609,7 @@ fhandler_base::fpathconf (int v)
case _PC_NAME_MAX: case _PC_NAME_MAX:
/* NAME_MAX is without trailing \0 */ /* NAME_MAX is without trailing \0 */
if (!pc.isdir ()) if (!pc.isdir ())
return NAME_MAX; return NAME_MAX;
ret = NT_MAX_PATH - strlen (get_name ()) - 2; ret = NT_MAX_PATH - strlen (get_name ()) - 2;
return ret < 0 ? 0 : ret > NAME_MAX ? NAME_MAX : ret; return ret < 0 ? 0 : ret > NAME_MAX ? NAME_MAX : ret;
case _PC_PATH_MAX: case _PC_PATH_MAX:

View File

@ -785,7 +785,7 @@ fhandler_disk_file::fchmod (mode_t mode)
if (pc.fs_is_nfs ()) if (pc.fs_is_nfs ())
{ {
/* chmod on NFS shares works by writing an EA of type NfsV3Attributes. /* chmod on NFS shares works by writing an EA of type NfsV3Attributes.
Only type and mode have to be set. Apparently type isn't checked Only type and mode have to be set. Apparently type isn't checked
for consistency, so it's sufficent to set it to NF3REG all the time. */ for consistency, so it's sufficent to set it to NF3REG all the time. */
struct { struct {
FILE_FULL_EA_INFORMATION ffei; FILE_FULL_EA_INFORMATION ffei;
@ -806,7 +806,7 @@ fhandler_disk_file::fchmod (mode_t mode)
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
else else
res = 0; res = 0;
goto out; goto out;
} }
@ -1582,7 +1582,7 @@ fhandler_disk_file::opendir (int fd)
{ {
dir->__flags |= dirent_set_d_ino; dir->__flags |= dirent_set_d_ino;
if (pc.fs_is_nfs ()) if (pc.fs_is_nfs ())
dir->__flags |= dirent_nfs_d_ino; dir->__flags |= dirent_nfs_d_ino;
else if (wincap.has_fileid_dirinfo () else if (wincap.has_fileid_dirinfo ()
&& !pc.has_buggy_fileid_dirinfo ()) && !pc.has_buggy_fileid_dirinfo ())
dir->__flags |= dirent_get_d_ino; dir->__flags |= dirent_get_d_ino;
@ -1853,7 +1853,7 @@ go_ahead:
{ {
FileName = ((PFILE_NAMES_INFORMATION) buf)->FileName; FileName = ((PFILE_NAMES_INFORMATION) buf)->FileName;
FileNameLength = ((PFILE_NAMES_INFORMATION) buf)->FileNameLength; FileNameLength = ((PFILE_NAMES_INFORMATION) buf)->FileNameLength;
} }
else else
{ {
FileName = ((PFILE_DIRECTORY_INFORMATION) buf)->FileName; FileName = ((PFILE_DIRECTORY_INFORMATION) buf)->FileName;

View File

@ -86,13 +86,26 @@ fhandler_fifo::open (int flags, mode_t)
LPSECURITY_ATTRIBUTES sa_buf = LPSECURITY_ATTRIBUTES sa_buf =
sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid()); sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
mode |= FILE_FLAG_OVERLAPPED; mode |= FILE_FLAG_OVERLAPPED;
HANDLE h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
PIPE_UNLIMITED_INSTANCES, 0, 0, HANDLE h;
NMPWAIT_WAIT_FOREVER, sa_buf); DWORD err;
bool nonblocking_write = !!((flags & (O_WRONLY | O_NONBLOCK)) == (O_WRONLY | O_NONBLOCK));
if (nonblocking_write)
{
h = INVALID_HANDLE_VALUE;
err = ERROR_ACCESS_DENIED;
}
else
{
h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
PIPE_UNLIMITED_INSTANCES, 0, 0,
NMPWAIT_WAIT_FOREVER, sa_buf);
err = GetLastError ();
}
if (h != INVALID_HANDLE_VALUE) if (h != INVALID_HANDLE_VALUE)
wait_state = fifo_wait_for_client; wait_state = fifo_wait_for_client;
else else
switch (GetLastError ()) switch (err)
{ {
case ERROR_ACCESS_DENIED: case ERROR_ACCESS_DENIED:
h = open_nonserver (npname, low_flags, sa_buf); h = open_nonserver (npname, low_flags, sa_buf);
@ -101,6 +114,11 @@ fhandler_fifo::open (int flags, mode_t)
wait_state = fifo_wait_for_server; wait_state = fifo_wait_for_server;
break; break;
} }
if (nonblocking_write && GetLastError () == ERROR_FILE_NOT_FOUND)
{
set_errno (ENXIO);
break;
}
/* fall through intentionally */ /* fall through intentionally */
default: default:
__seterrno (); __seterrno ();

View File

@ -1,6 +1,6 @@
/* fhandler_netdrive.cc: fhandler for // and //MACHINE handling /* fhandler_netdrive.cc: fhandler for // and //MACHINE handling
Copyright 2005 Red Hat, Inc. Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -107,7 +107,7 @@ thread_netdrive (void *arg)
case GET_RESOURCE_ENUM: case GET_RESOURCE_ENUM:
nh = (struct net_hdls *) ndi->in; nh = (struct net_hdls *) ndi->in;
if (!nh->dom) if (!nh->dom)
{ {
ndi->ret = ERROR_NO_MORE_ITEMS; ndi->ret = ERROR_NO_MORE_ITEMS;
break; break;
} }

View File

@ -354,7 +354,7 @@ fhandler_base::del_my_locks (bool after_fork)
if (node) if (node)
{ {
bool no_locks_left = bool no_locks_left =
node->del_my_locks (after_fork ? 0 : get_unique_id (), get_handle ()); node->del_my_locks (after_fork ? 0 : get_unique_id (), get_handle ());
if (no_locks_left) if (no_locks_left)
{ {
LIST_REMOVE (node, i_next); LIST_REMOVE (node, i_next);
@ -501,28 +501,28 @@ inode_t::get_all_locks_list ()
continue; continue;
short type = wcstol (endptr + 1, &endptr, 16); short type = wcstol (endptr + 1, &endptr, 16);
if ((type != F_RDLCK && type != F_WRLCK) || !endptr || *endptr != L'-') if ((type != F_RDLCK && type != F_WRLCK) || !endptr || *endptr != L'-')
continue; continue;
_off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16); _off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
if (start < 0 || !endptr || *endptr != L'-') if (start < 0 || !endptr || *endptr != L'-')
continue; continue;
_off64_t end = (_off64_t) wcstoull (endptr + 1, &endptr, 16); _off64_t end = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
if (end < -1LL || (end > 0 && end < start) || !endptr || *endptr != L'-') if (end < -1LL || (end > 0 && end < start) || !endptr || *endptr != L'-')
continue; continue;
long long id = wcstoll (endptr + 1, &endptr, 16); long long id = wcstoll (endptr + 1, &endptr, 16);
if (!endptr || *endptr != L'-' if (!endptr || *endptr != L'-'
|| ((flags & F_POSIX) && (id < 1 || id > ULONG_MAX))) || ((flags & F_POSIX) && (id < 1 || id > ULONG_MAX)))
continue; continue;
DWORD wid = wcstoul (endptr + 1, &endptr, 16); DWORD wid = wcstoul (endptr + 1, &endptr, 16);
if (endptr && *endptr != L'\0') if (endptr && *endptr != L'\0')
continue; continue;
if (lock - i_all_lf >= MAX_LOCKF_CNT) if (lock - i_all_lf >= MAX_LOCKF_CNT)
{ {
system_printf ("Warning, can't handle more than %d locks per file.", system_printf ("Warning, can't handle more than %d locks per file.",
MAX_LOCKF_CNT); MAX_LOCKF_CNT);
break; break;
} }
if (lock > i_all_lf) if (lock > i_all_lf)
lock[-1].lf_next = lock; lock[-1].lf_next = lock;
new (lock++) lockf_t (this, &i_all_lf, flags, type, start, end, id, wid); new (lock++) lockf_t (this, &i_all_lf, flags, type, start, end, id, wid);
} }
/* If no lock has been found, return NULL. */ /* If no lock has been found, return NULL. */
@ -652,21 +652,21 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
a_op = F_UNLCK; a_op = F_UNLCK;
break; break;
case F_RDLCK: case F_RDLCK:
if (!(get_access () & GENERIC_READ)) if (!(get_access () & GENERIC_READ))
{ {
set_errno (EBADF); set_errno (EBADF);
return -1; return -1;
} }
break; break;
case F_WRLCK: case F_WRLCK:
if (!(get_access () & GENERIC_WRITE)) if (!(get_access () & GENERIC_WRITE))
{ {
set_errno (EBADF); set_errno (EBADF);
return -1; return -1;
} }
break; break;
default: default:
set_errno (EINVAL); set_errno (EINVAL);
return -1; return -1;
} }
@ -776,7 +776,7 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
{ {
clean = new lockf_t (); clean = new lockf_t ();
if (!clean) if (!clean)
{ {
node->UNLOCK (); node->UNLOCK ();
set_errno (ENOLCK); set_errno (ENOLCK);
return -1; return -1;
@ -896,7 +896,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
* do not go off into neverland. * do not go off into neverland.
*/ */
/* FIXME: We check the handle count of all the lock event objects /* FIXME: We check the handle count of all the lock event objects
this process holds. If it's > 1, another process is this process holds. If it's > 1, another process is
waiting for one of our locks. This method isn't overly waiting for one of our locks. This method isn't overly
intelligent. If it turns out to be too dumb, we might intelligent. If it turns out to be too dumb, we might
have to remove it or to find another method. */ have to remove it or to find another method. */
@ -937,7 +937,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
} }
SetThreadPriority (GetCurrentThread (), priority); SetThreadPriority (GetCurrentThread (), priority);
if (lock->lf_flags & F_POSIX) if (lock->lf_flags & F_POSIX)
{ {
HANDLE proc = OpenProcess (SYNCHRONIZE, FALSE, block->lf_wid); HANDLE proc = OpenProcess (SYNCHRONIZE, FALSE, block->lf_wid);
if (!proc) if (!proc)
{ {
@ -955,7 +955,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
CloseHandle (proc); CloseHandle (proc);
} }
else else
{ {
HANDLE w4[2] = { obj, signal_arrived }; HANDLE w4[2] = { obj, signal_arrived };
node->UNLOCK (); node->UNLOCK ();
/* Unfortunately, since BSD flock locks are not attached to a /* Unfortunately, since BSD flock locks are not attached to a
@ -1016,16 +1016,16 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
*/ */
switch (ovcase) switch (ovcase)
{ {
case 0: /* no overlap */ case 0: /* no overlap */
if (needtolink) if (needtolink)
{ {
*prev = lock; *prev = lock;
lock->lf_next = overlap; lock->lf_next = overlap;
lock->create_lock_obj (); lock->create_lock_obj ();
} }
break; break;
case 1: /* overlap == lock */ case 1: /* overlap == lock */
/* /*
* If downgrading lock, others may be * If downgrading lock, others may be
* able to acquire it. * able to acquire it.
@ -1038,7 +1038,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
*clean = lock; *clean = lock;
break; break;
case 2: /* overlap contains lock */ case 2: /* overlap contains lock */
/* /*
* Check for common starting point and different types. * Check for common starting point and different types.
*/ */
@ -1063,7 +1063,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
lock->lf_next->create_lock_obj (); lock->lf_next->create_lock_obj ();
break; break;
case 3: /* lock contains overlap */ case 3: /* lock contains overlap */
/* /*
* If downgrading lock, others may be able to * If downgrading lock, others may be able to
* acquire it, otherwise take the list. * acquire it, otherwise take the list.
@ -1087,7 +1087,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
*clean = overlap; *clean = overlap;
continue; continue;
case 4: /* overlap starts before lock */ case 4: /* overlap starts before lock */
/* /*
* Add lock after overlap on the list. * Add lock after overlap on the list.
*/ */
@ -1101,7 +1101,7 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
needtolink = 0; needtolink = 0;
continue; continue;
case 5: /* overlap ends after lock */ case 5: /* overlap ends after lock */
/* /*
* Add the new lock before overlap. * Add the new lock before overlap.
*/ */
@ -1146,13 +1146,13 @@ lf_clearlock (lockf_t *unlock, lockf_t **clean, HANDLE fhdl)
switch (ovcase) switch (ovcase)
{ {
case 1: /* overlap == lock */ case 1: /* overlap == lock */
*prev = overlap->lf_next; *prev = overlap->lf_next;
overlap->lf_next = *clean; overlap->lf_next = *clean;
*clean = overlap; *clean = overlap;
break; break;
case 2: /* overlap contains lock: split it */ case 2: /* overlap contains lock: split it */
if (overlap->lf_start == unlock->lf_start) if (overlap->lf_start == unlock->lf_start)
{ {
overlap->lf_start = unlock->lf_end + 1; overlap->lf_start = unlock->lf_end + 1;
@ -1166,24 +1166,24 @@ lf_clearlock (lockf_t *unlock, lockf_t **clean, HANDLE fhdl)
overlap->lf_next->create_lock_obj (); overlap->lf_next->create_lock_obj ();
break; break;
case 3: /* lock contains overlap */ case 3: /* lock contains overlap */
*prev = overlap->lf_next; *prev = overlap->lf_next;
lf = overlap->lf_next; lf = overlap->lf_next;
overlap->lf_next = *clean; overlap->lf_next = *clean;
*clean = overlap; *clean = overlap;
continue; continue;
case 4: /* overlap starts before lock */ case 4: /* overlap starts before lock */
overlap->lf_end = unlock->lf_start - 1; overlap->lf_end = unlock->lf_start - 1;
prev = &overlap->lf_next; prev = &overlap->lf_next;
lf = overlap->lf_next; lf = overlap->lf_next;
overlap->create_lock_obj (); overlap->create_lock_obj ();
continue; continue;
case 5: /* overlap ends after lock */ case 5: /* overlap ends after lock */
overlap->lf_start = unlock->lf_end + 1; overlap->lf_start = unlock->lf_end + 1;
overlap->create_lock_obj (); overlap->create_lock_obj ();
break; break;
} }
break; break;
} }
@ -1295,7 +1295,7 @@ lf_findoverlap (lockf_t *lf, lockf_t *lock, int type, lockf_t ***prev,
*prev = &lf->lf_next; *prev = &lf->lf_next;
*overlap = lf = lf->lf_next; *overlap = lf = lf->lf_next;
continue; continue;
} }
/* /*
* OK, check for overlap * OK, check for overlap
* *
@ -1316,7 +1316,7 @@ lf_findoverlap (lockf_t *lf, lockf_t *lock, int type, lockf_t ***prev,
*prev = &lf->lf_next; *prev = &lf->lf_next;
*overlap = lf = lf->lf_next; *overlap = lf = lf->lf_next;
continue; continue;
} }
if ((lf->lf_start == start) && (lf->lf_end == end)) if ((lf->lf_start == start) && (lf->lf_end == end))
{ {
/* Case 1 */ /* Case 1 */

View File

@ -326,14 +326,14 @@ details. */
181: Export cygwin_conv_path, cygwin_create_path, cygwin_conv_path_list. 181: Export cygwin_conv_path, cygwin_create_path, cygwin_conv_path_list.
182: Export lockf. 182: Export lockf.
FIXME: Removed 12 year old and entirely wrong wprintf function at FIXME: Removed 12 year old and entirely wrong wprintf function at
this point. We need a working implementation soon. this point. We need a working implementation soon.
183: Export open_memstream, fmemopen. 183: Export open_memstream, fmemopen.
184: Export openat, faccessat, fchmodat, fchownat, fstatat, futimesat, 184: Export openat, faccessat, fchmodat, fchownat, fstatat, futimesat,
linkat, mkdirat, mkfifoat, mknodat, readlinkat, renameat, symlinkat, linkat, mkdirat, mkfifoat, mknodat, readlinkat, renameat, symlinkat,
unlinkat. unlinkat.
185: Export futimens, utimensat. 185: Export futimens, utimensat.
186: Remove ancient V8 regexp functions. Also eliminate old crt0 interface 186: Remove ancient V8 regexp functions. Also eliminate old crt0 interface
which provided its own user_data structure. which provided its own user_data structure.
187: Export cfmakeraw. 187: Export cfmakeraw.
188: Export CW_SET_PRIV_KEY. 188: Export CW_SET_PRIV_KEY.
*/ */

View File

@ -43,7 +43,7 @@ details. */
(path_prefix_p (proc, (path), proc_len, false)) (path_prefix_p (proc, (path), proc_len, false))
/* is_unc_share: Return non-zero if PATH begins with //server/share /* is_unc_share: Return non-zero if PATH begins with //server/share
or with one of the native prefixes //./ or //?/ or with one of the native prefixes //./ or //?/
This function is only used to test for valid input strings. This function is only used to test for valid input strings.
The later normalization drops the native prefixes. */ The later normalization drops the native prefixes. */
@ -643,21 +643,21 @@ read_flags (char *options, unsigned &flags)
{ {
char *p = strchr (options, ','); char *p = strchr (options, ',');
if (p) if (p)
*p++ = '\0'; *p++ = '\0';
else else
p = strchr (options, '\0'); p = strchr (options, '\0');
for (opt *o = oopts; for (opt *o = oopts;
o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o < (oopts + (sizeof (oopts) / sizeof (oopts[0])));
o++) o++)
if (strcmp (options, o->name) == 0) if (strcmp (options, o->name) == 0)
{ {
if (o->clear) if (o->clear)
flags &= ~o->val; flags &= ~o->val;
else else
flags |= o->val; flags |= o->val;
goto gotit; goto gotit;
} }
system_printf ("invalid fstab option - '%s'", options); system_printf ("invalid fstab option - '%s'", options);
return false; return false;
@ -736,7 +736,7 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
NT_MAX_PATH - (fstab_end - fstab), NT_MAX_PATH - (fstab_end - fstab),
cygheap->user.name ()); cygheap->user.name ());
/* Make sure special chars in the username are converted according to /* Make sure special chars in the username are converted according to
the rules. */ the rules. */
transform_chars (username, username + wcslen (username) - 1); transform_chars (username, username + wcslen (username) - 1);
} }
RtlInitUnicodeString (&upath, fstab); RtlInitUnicodeString (&upath, fstab);
@ -770,7 +770,7 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
retry: retry:
bool got_nl = false; bool got_nl = false;
while (got < buf + len && (end = strchr (got, '\n'))) while (got < buf + len && (end = strchr (got, '\n')))
{ {
got_nl = true; got_nl = true;
end[end[-1] == '\r' ? -1 : 0] = '\0'; end[end[-1] == '\r' ? -1 : 0] = '\0';
if (!from_fstab_line (got, user)) if (!from_fstab_line (got, user))
@ -779,21 +779,21 @@ retry:
++line; ++line;
} }
if (len < (sizeof (buf) - 2)) if (len < (sizeof (buf) - 2))
break; break;
/* Check if the buffer contained at least one \n. If not, the /* Check if the buffer contained at least one \n. If not, the
line length is > 32K. We don't take such long lines. Print line length is > 32K. We don't take such long lines. Print
a debug message and skip this line entirely. */ a debug message and skip this line entirely. */
if (!got_nl) if (!got_nl)
{ {
system_printf ("%W: Line %d too long, skipping...", fstab, line); system_printf ("%W: Line %d too long, skipping...", fstab, line);
while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, buf, while (NT_SUCCESS (NtReadFile (fh, NULL, NULL, NULL, &io, buf,
(sizeof (buf) - 2), NULL, NULL))) (sizeof (buf) - 2), NULL, NULL)))
{ {
len = io.Information; len = io.Information;
buf[len] = buf[len + 1] = '\0'; buf[len] = buf[len + 1] = '\0';
got = strchr (buf, '\n'); got = strchr (buf, '\n');
if (got) if (got)
{ {
++got; ++got;
++line; ++line;
goto retry; goto retry;
@ -803,7 +803,7 @@ retry:
break; break;
} }
/* We have to read once more. Move remaining bytes to the start of /* We have to read once more. Move remaining bytes to the start of
the buffer and reposition got so that it points to the end of the buffer and reposition got so that it points to the end of
the remaining bytes. */ the remaining bytes. */
len = buf + len - got; len = buf + len - got;
memmove (buf, got, len); memmove (buf, got, len);
@ -869,7 +869,7 @@ mount_info::get_cygdrive_info (char *user, char *system, char *user_flags,
strcpy (path, cygdrive); strcpy (path, cygdrive);
/* Strip trailing slash for backward compatibility. */ /* Strip trailing slash for backward compatibility. */
if (cygdrive_len > 2) if (cygdrive_len > 2)
path[cygdrive_len - 1] = '\0'; path[cygdrive_len - 1] = '\0';
} }
if (flags) if (flags)
strcpy (flags, (cygdrive_flags & MOUNT_BINARY) ? "binmode" : "textmode"); strcpy (flags, (cygdrive_flags & MOUNT_BINARY) ? "binmode" : "textmode");
@ -1017,7 +1017,7 @@ mount_info::add_item (const char *native, const char *posix,
for (i = 0; i < nmounts; i++) for (i = 0; i < nmounts; i++)
{ {
if (!strcmp (mount[i].posix_path, posixtmp)) if (!strcmp (mount[i].posix_path, posixtmp))
{ {
/* Don't allow to override a system mount with a user mount. */ /* Don't allow to override a system mount with a user mount. */
if ((mount[i].flags & MOUNT_SYSTEM) && !(mountflags & MOUNT_SYSTEM)) if ((mount[i].flags & MOUNT_SYSTEM) && !(mountflags & MOUNT_SYSTEM))
{ {

View File

@ -14,5 +14,5 @@ struct nfs_aol_ffei_t nfs_aol_ffei = { 0, 0, sizeof (NFS_ACT_ON_LINK) - 1, 0,
NFS_ACT_ON_LINK }; NFS_ACT_ON_LINK };
uint32_t nfs_type_mapping[] = { 0, S_IFREG, S_IFDIR, S_IFBLK, uint32_t nfs_type_mapping[] = { 0, S_IFREG, S_IFDIR, S_IFBLK,
S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO }; S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO };

View File

@ -203,10 +203,10 @@ typedef struct _FILE_ID_BOTH_DIR_INFORMATION
/* Specific ACCESS_MASKSs for objects created in Cygwin. */ /* Specific ACCESS_MASKSs for objects created in Cygwin. */
#define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \ #define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \
| DIRECTORY_TRAVERSE \ | DIRECTORY_TRAVERSE \
| DIRECTORY_CREATE_SUBDIRECTORY \ | DIRECTORY_CREATE_SUBDIRECTORY \
| DIRECTORY_CREATE_OBJECT \ | DIRECTORY_CREATE_OBJECT \
| READ_CONTROL) | READ_CONTROL)
#define CYG_MUTANT_ACCESS (MUTANT_QUERY_STATE \ #define CYG_MUTANT_ACCESS (MUTANT_QUERY_STATE \
| SYNCHRONIZE \ | SYNCHRONIZE \
@ -863,7 +863,7 @@ extern "C"
NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK, NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES); POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
EVENT_TYPE, BOOLEAN); EVENT_TYPE, BOOLEAN);
NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG, PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG,
ULONG, ULONG, PVOID, ULONG); ULONG, ULONG, PVOID, ULONG);

View File

@ -1,4 +1,4 @@
/* path.cc: path support. /* path.cc: path support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008 Red Hat, Inc. 2006, 2007, 2008 Red Hat, Inc.
@ -505,7 +505,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
&& FS_IS_SAMBA); && FS_IS_SAMBA);
if (!is_samba ()) if (!is_samba ())
{ {
is_netapp (RtlEqualUnicodeString (&fsname, &testname, FALSE) is_netapp (RtlEqualUnicodeString (&fsname, &testname, FALSE)
&& FS_IS_NETAPP_DATAONTAP); && FS_IS_NETAPP_DATAONTAP);
@ -515,7 +515,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
if (!is_nfs ()) if (!is_nfs ())
{ {
/* Known remote file systems which can't handle calls to /* Known remote file systems which can't handle calls to
NtQueryDirectoryFile(FileIdBothDirectoryInformation) */ NtQueryDirectoryFile(FileIdBothDirectoryInformation) */
RtlInitUnicodeString (&testname, L"UNIXFS"); RtlInitUnicodeString (&testname, L"UNIXFS");
has_buggy_fileid_dirinfo (RtlEqualUnicodeString (&fsname, has_buggy_fileid_dirinfo (RtlEqualUnicodeString (&fsname,
&testname, &testname,
@ -1525,6 +1525,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
NTSTATUS status; NTSTATUS status;
HANDLE fh; HANDLE fh;
tmp_pathbuf tp; tmp_pathbuf tp;
unsigned check_opt;
/* POSIX says that empty 'newpath' is invalid input while empty /* POSIX says that empty 'newpath' is invalid input while empty
'oldpath' is valid -- it's symlink resolver job to verify if 'oldpath' is valid -- it's symlink resolver job to verify if
@ -1551,14 +1552,16 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
set_errno (ENOENT); set_errno (ENOENT);
goto done; goto done;
} }
check_opt = PC_SYM_NOFOLLOW | PC_POSIX | (isdevice ? PC_NOWARN : 0);
/* We need the normalized full path below. */ /* We need the normalized full path below. */
win32_newpath.check (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes); win32_newpath.check (newpath, check_opt, stat_suffixes);
if (use_winsym && !win32_newpath.exists () if (use_winsym && !win32_newpath.exists ()
&& (isdevice || !win32_newpath.fs_is_nfs ())) && (isdevice || !win32_newpath.fs_is_nfs ()))
{ {
char *newplnk = tp.c_get (); char *newplnk = tp.c_get ();
stpcpy (stpcpy (newplnk, newpath), ".lnk"); stpcpy (stpcpy (newplnk, newpath), ".lnk");
win32_newpath.check (newplnk, PC_SYM_NOFOLLOW | PC_POSIX); win32_newpath.check (newplnk, check_opt);
} }
if (win32_newpath.error) if (win32_newpath.error)
@ -1621,7 +1624,11 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
/* The symlink target is relative to the directory in which /* The symlink target is relative to the directory in which
the symlink gets created, not relative to the cwd. Therefore the symlink gets created, not relative to the cwd. Therefore
we have to mangle the path quite a bit before calling path_conv. */ we have to mangle the path quite a bit before calling path_conv. */
if (!isabspath (oldpath)) if (isabspath (oldpath))
win32_oldpath.check (oldpath,
PC_SYM_NOFOLLOW,
stat_suffixes);
else
{ {
len = strrchr (win32_newpath.normalized_path, '/') len = strrchr (win32_newpath.normalized_path, '/')
- win32_newpath.normalized_path + 1; - win32_newpath.normalized_path + 1;
@ -1630,8 +1637,6 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
oldpath); oldpath);
win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes); win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes);
} }
else
win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
if (SUCCEEDED (SHGetDesktopFolder (&psl))) if (SUCCEEDED (SHGetDesktopFolder (&psl)))
{ {
WCHAR wc_path[win32_oldpath.get_wide_win32_path_len () + 1]; WCHAR wc_path[win32_oldpath.get_wide_win32_path_len () + 1];
@ -1777,7 +1782,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
} }
if (win32_newpath.has_acls () && win32_newpath.isremote ()) if (win32_newpath.has_acls () && win32_newpath.isremote ())
set_file_attribute (fh, win32_newpath, ILLEGAL_UID, ILLEGAL_GID, set_file_attribute (fh, win32_newpath, ILLEGAL_UID, ILLEGAL_GID,
S_IFLNK | STD_RBITS | STD_WBITS); S_IFLNK | STD_RBITS | STD_WBITS);
status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, cp - buf, NULL, NULL); status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, cp - buf, NULL, NULL);
if (NT_SUCCESS (status) && io.Information == (ULONG) (cp - buf)) if (NT_SUCCESS (status) && io.Information == (ULONG) (cp - buf))
{ {

View File

@ -1221,7 +1221,8 @@ lsaprivkeyauth (struct passwd *pw)
} }
/* The key is not 0-terminated. */ /* The key is not 0-terminated. */
PWCHAR passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR)); PWCHAR passwd;
passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
*wcpncpy (passwd, data->Buffer, data->Length / sizeof (WCHAR)) = L'\0'; *wcpncpy (passwd, data->Buffer, data->Length / sizeof (WCHAR)) = L'\0';
LsaFreeMemory (data); LsaFreeMemory (data);
debug_printf ("Try logon for %W\\%W", domain, user); debug_printf ("Try logon for %W\\%W", domain, user);

View File

@ -52,10 +52,10 @@ get_shared_parent_dir ()
_cygwin_testing ? cygwin_version.dll_build_date : ""); _cygwin_testing ? cygwin_version.dll_build_date : "");
RtlInitUnicodeString (&uname, bnoname); RtlInitUnicodeString (&uname, bnoname);
InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF, InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF,
NULL, everyone_sd (CYG_SHARED_DIR_ACCESS)); NULL, everyone_sd (CYG_SHARED_DIR_ACCESS));
status = NtCreateDirectoryObject (&dir, CYG_SHARED_DIR_ACCESS, &attr); status = NtCreateDirectoryObject (&dir, CYG_SHARED_DIR_ACCESS, &attr);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
api_fatal ("NtCreateDirectoryObject(%S): %p", &uname, status); api_fatal ("NtCreateDirectoryObject(%S): %p", &uname, status);
} }
return dir; return dir;
} }
@ -77,7 +77,7 @@ get_session_parent_dir ()
if (!NT_SUCCESS (status) || psi.SessionId == 0) if (!NT_SUCCESS (status) || psi.SessionId == 0)
dir = get_shared_parent_dir (); dir = get_shared_parent_dir ();
else else
{ {
WCHAR bnoname[MAX_PATH]; WCHAR bnoname[MAX_PATH];
__small_swprintf (bnoname, __small_swprintf (bnoname,
L"\\Sessions\\BNOLINKS\\%d\\%s%s", L"\\Sessions\\BNOLINKS\\%d\\%s%s",
@ -150,7 +150,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
else else
{ {
shared_h = CreateFileMapping (INVALID_HANDLE_VALUE, psa, shared_h = CreateFileMapping (INVALID_HANDLE_VALUE, psa,
PAGE_READWRITE, 0, size, mapname); PAGE_READWRITE, 0, size, mapname);
if (GetLastError () == ERROR_ALREADY_EXISTS) if (GetLastError () == ERROR_ALREADY_EXISTS)
m = SH_JUSTOPEN; m = SH_JUSTOPEN;
} }
@ -211,7 +211,7 @@ user_shared_initialize ()
/* Correct the user name with what's defined in /etc/passwd before /* Correct the user name with what's defined in /etc/passwd before
loading the user fstab file. */ loading the user fstab file. */
if (pw) if (pw)
cygheap->user.set_name (pw->pw_name); cygheap->user.set_name (pw->pw_name);
user_shared->mountinfo.init (); /* Initialize the mount table. */ user_shared->mountinfo.init (); /* Initialize the mount table. */
user_shared->cb = sizeof (*user_shared); user_shared->cb = sizeof (*user_shared);
} }

View File

@ -480,7 +480,7 @@ spawn_guts (const char *prog_arg, const char *const *argv,
|| (runpath[5] != L':' /* UNC path */ || (runpath[5] != L':' /* UNC path */
&& len < (MAX_PATH + 6) * sizeof (WCHAR))) && len < (MAX_PATH + 6) * sizeof (WCHAR)))
{ {
PWCHAR r = runpath + 4; PWCHAR r = runpath + 4;
if (r[1] != L':') /* UNC path */ if (r[1] != L':') /* UNC path */
*(r += 2) = L'\\'; *(r += 2) = L'\\';
if (!RtlIsDosDeviceName_U (r)) if (!RtlIsDosDeviceName_U (r))

View File

@ -2537,7 +2537,7 @@ seteuid32 (__uid32_t uid)
{ {
new_token = lsaprivkeyauth (pw_new); new_token = lsaprivkeyauth (pw_new);
if (new_token) if (new_token)
{ {
/* We have to verify this token since settings in /etc/group /* We have to verify this token since settings in /etc/group
might render it unusable im terms of group membership. */ might render it unusable im terms of group membership. */
if (!verify_token (new_token, usersid, groups)) if (!verify_token (new_token, usersid, groups))
@ -2547,7 +2547,7 @@ seteuid32 (__uid32_t uid)
} }
} }
if (!new_token) if (!new_token)
{ {
debug_printf ("lsaprivkeyauth failed, try lsaauth."); debug_printf ("lsaprivkeyauth failed, try lsaauth.");
if (!(new_token = lsaauth (usersid, groups, pw_new))) if (!(new_token = lsaauth (usersid, groups, pw_new)))
{ {
@ -3619,7 +3619,7 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname,
if (dirfd == AT_FDCWD) if (dirfd == AT_FDCWD)
p = stpcpy (path_ret, cygheap->cwd.posix); p = stpcpy (path_ret, cygheap->cwd.posix);
else else
{ {
cygheap_fdget cfd (dirfd); cygheap_fdget cfd (dirfd);
if (cfd < 0) if (cfd < 0)
return -1; return -1;
@ -3631,7 +3631,7 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname,
p = stpcpy (path_ret, cfd->get_name ()); p = stpcpy (path_ret, cfd->get_name ());
} }
if (!p) if (!p)
{ {
set_errno (ENOTDIR); set_errno (ENOTDIR);
return -1; return -1;
} }