Remove extraneous whitespace.

* pinfo.cc (commune_process): Use default argument to lock_process.
* sigproc.cc: Update copyright.
* select.cc: Ditto.
This commit is contained in:
Christopher Faylor 2007-02-20 00:16:18 +00:00
parent b440e09025
commit 510a85cbf9
18 changed files with 166 additions and 162 deletions

View File

@ -1,3 +1,10 @@
2007-02-19 Christopher Faylor <me@cgf.cx>
Remove extraneous whitespace.
* pinfo.cc (commune_process): Use default argument to lock_process.
* sigproc.cc: Update copyright.
* select.cc: Ditto.
2007-02-15 Corinna Vinschen <corinna@vinschen.de>
* posix_ipc.cc (mq_open): Avoid compiler warning. Initialize mqhdr

View File

@ -528,7 +528,7 @@ _cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT
case STATUS_ACCESS_VIOLATION:
switch (mmap_is_attached_or_noreserve ((void *)e->ExceptionInformation[1],
1))
{
{
case MMAP_NORESERVE_COMMITED:
return 0;
case MMAP_RAISE_SIGBUS: /* MAP_NORESERVE page, commit failed, or

View File

@ -690,7 +690,7 @@ fhandler_base::open (int flags, mode_t mode)
Per MSDN you have to create the file with the same attributes as
already specified for the file. */
if (has_attribute (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM))
file_attributes |= pc.file_attributes ();
file_attributes |= pc.file_attributes ();
/* If the file should actually be created and ntsec is on,
set files attributes. */
@ -1292,7 +1292,7 @@ rootdir (const char *full_path, char *root_path)
}
}
while (--c > min_c && *c != '\\')
;
;
}
return root_path;
@ -1826,12 +1826,12 @@ fhandler_base::fpathconf (int v)
? LINK_MAX : 1;
case _PC_MAX_CANON:
if (is_tty ())
return MAX_CANON;
return MAX_CANON;
set_errno (EINVAL);
break;
case _PC_MAX_INPUT:
if (is_tty ())
return MAX_INPUT;
return MAX_INPUT;
set_errno (EINVAL);
break;
case _PC_NAME_MAX:
@ -1844,7 +1844,7 @@ fhandler_base::fpathconf (int v)
if (pc.isdir ()
|| get_device () == FH_FIFO || get_device () == FH_PIPE
|| get_device () == FH_PIPER || get_device () == FH_PIPEW)
return PIPE_BUF;
return PIPE_BUF;
set_errno (EINVAL);
break;
case _PC_CHOWN_RESTRICTED:
@ -1853,7 +1853,7 @@ fhandler_base::fpathconf (int v)
return 1;
case _PC_VDISABLE:
if (is_tty ())
return _POSIX_VDISABLE;
return _POSIX_VDISABLE;
set_errno (EINVAL);
break;
case _PC_ASYNC_IO:
@ -1870,7 +1870,7 @@ fhandler_base::fpathconf (int v)
case _PC_POSIX_PERMISSIONS:
case _PC_POSIX_SECURITY:
if (get_device () == FH_FS)
return check_posix_perm (get_win32_name (), v);
return check_posix_perm (get_win32_name (), v);
set_errno (EINVAL);
break;
default:

View File

@ -400,7 +400,7 @@ fhandler_console::read (void *pv, size_t& buflen)
toadd = tmp + 1;
else if (dev_state->metabit)
{
tmp[1] |= 0x80;
tmp[1] |= 0x80;
toadd = tmp + 1;
}
else
@ -959,7 +959,7 @@ dev_console::set_color (HANDLE h)
win_fg = win_bg;
else if (intensity == INTENSITY_BOLD)
/* apply foreground intensity only in non-reverse mode! */
if (reverse)
if (reverse)
win_bg |= BACKGROUND_INTENSITY;
else
win_fg |= FOREGROUND_INTENSITY;

View File

@ -809,7 +809,7 @@ fhandler_disk_file::fadvise (_off64_t offset, _off64_t length, int advice)
{
fmi.Mode &= ~FILE_SEQUENTIAL_ONLY;
if (advice == POSIX_FADV_SEQUENTIAL)
fmi.Mode |= FILE_SEQUENTIAL_ONLY;
fmi.Mode |= FILE_SEQUENTIAL_ONLY;
status = NtSetInformationFile (get_handle (), &io, &fmi, sizeof fmi,
FileModeInformation);
if (NT_SUCCESS (status))
@ -839,12 +839,12 @@ fhandler_disk_file::ftruncate (_off64_t length, bool allow_truncate)
actual_length += ((_off64_t) size_high) << 32;
/* If called through posix_fallocate, silently succeed if length
is less than the file's actual length. */
is less than the file's actual length. */
if (!allow_truncate && length < actual_length)
return 0;
if (wincap.is_winnt ())
{
{
NTSTATUS status;
IO_STATUS_BLOCK io;
FILE_END_OF_FILE_INFORMATION feofi;
@ -872,7 +872,7 @@ fhandler_disk_file::ftruncate (_off64_t length, bool allow_truncate)
res = 0;
}
else
{
{
_off64_t prev_loc = lseek (0, SEEK_CUR);
if (lseek (length, SEEK_SET) >= 0)
{
@ -1468,7 +1468,7 @@ fhandler_disk_file::rmdir ()
{
rc = !(err = unlink_nt (pc, pc.has_attribute (FILE_ATTRIBUTE_READONLY)));
if (err)
SetLastError (err);
SetLastError (err);
}
else
rc = RemoveDirectory (get_win32_name ());
@ -1599,7 +1599,7 @@ fhandler_disk_file::opendir ()
SECURITY_ATTRIBUTES sa = sec_none;
pc.get_nt_native_path (upath);
InitializeObjectAttributes (&attr, &upath,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
NULL, sa.lpSecurityDescriptor);
status = NtOpenFile (&dir->__handle,
SYNCHRONIZE | FILE_LIST_DIRECTORY,
@ -1793,7 +1793,7 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
mode using FileBothDirectoryInformation. So, what we do here is
to implement the solution suggested by Andrew Tridgell, we just
reread all entries up to dir->d_position using
FileBothDirectoryInformation.
FileBothDirectoryInformation.
However, We do *not* mark this server as broken and fall back to
using FileBothDirectoryInformation further on. This would slow
down every access to such a server, even for directories under
@ -1804,7 +1804,7 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
{
d_cachepos (dir) = 0;
for (int cnt = 0; cnt < dir->__d_position; ++cnt)
{
{
if (d_cachepos (dir) == 0)
{
status = NtQueryDirectoryFile (dir->__handle, NULL, NULL,
@ -1812,10 +1812,10 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
FileBothDirectoryInformation,
FALSE, NULL, cnt == 0);
if (!NT_SUCCESS (status))
goto go_ahead;
goto go_ahead;
}
buf = (PFILE_ID_BOTH_DIR_INFORMATION) (d_cache (dir)
+ d_cachepos (dir));
+ d_cachepos (dir));
if (buf->NextEntryOffset == 0)
d_cachepos (dir) = 0;
else
@ -1982,7 +1982,7 @@ fhandler_disk_file::rewinddir (DIR *dir)
{
d_cachepos (dir) = 0;
if (wincap.has_buggy_restart_scan () && isremote ())
{
{
/* This works around a W2K bug. The RestartScan parameter in calls
to NtQueryDirectoryFile on remote shares is ignored, thus
resulting in not being able to rewind on remote shares. By

View File

@ -187,7 +187,7 @@ out:
void
fhandler_registry::set_name (path_conv &in_pc)
{
{
if (strncasematch (in_pc.normalized_path, "/proc/registry32", 16))
{
wow64 = KEY_WOW64_32KEY;
@ -287,7 +287,7 @@ fhandler_registry::fstat (struct __stat64 *buf)
RegCloseKey (hKey);
}
else
{
{
/* Here's the problem: If we can't open the key, we don't know
nothing at all about the key/value. It's only clear that
the current user has no read access. At this point it's

View File

@ -423,12 +423,12 @@ search_wsa_event_slot (LONG new_serial_number)
HANDLE searchmtx = OpenMutex (STANDARD_RIGHTS_READ, FALSE,
shared_name (searchname, "sock", wsa_events[slot].serial_number));
if (!searchmtx)
break;
break;
/* Mutex still exists, attached socket is active, try next slot. */
CloseHandle (searchmtx);
slot = (slot + 1) % NUM_SOCKS;
if (slot == (new_serial_number % NUM_SOCKS))
{
{
/* Did the whole array once. Too bad. */
debug_printf ("No free socket slot");
ReleaseMutex (wsa_slot_mtx);
@ -463,7 +463,7 @@ fhandler_socket::init_events ()
}
err = GetLastError ();
if (err == ERROR_ALREADY_EXISTS)
CloseHandle (wsock_mtx);
CloseHandle (wsock_mtx);
}
while (err == ERROR_ALREADY_EXISTS);
if ((wsock_evt = CreateEvent (&sec_all, TRUE, FALSE, NULL))
@ -500,7 +500,7 @@ fhandler_socket::evaluate_events (const long event_mask, long &events,
if (!(WSAEnumNetworkEvents (get_socket (), wsock_evt, &evts)))
{
if (evts.lNetworkEvents)
{
{
LOCK_EVENTS;
wsock_events->events |= evts.lNetworkEvents;
events_now = (wsock_events->events & event_mask);
@ -947,7 +947,7 @@ fhandler_socket::listen (int backlog)
fails with WSAEINVAL when it's called on an unbound socket.
So we have to bind manually here to have POSIX semantics. */
if (get_addr_family () == AF_INET)
{
{
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_port = 0;
@ -956,8 +956,8 @@ fhandler_socket::listen (int backlog)
res = ::listen (get_socket (), backlog);
}
else if (get_addr_family () == AF_INET6)
{
struct sockaddr_in6 sin6 =
{
struct sockaddr_in6 sin6 =
{
sin6_family: AF_INET6,
sin6_port: 0,
@ -1085,7 +1085,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
{
res = ::getsockname (get_socket (), name, namelen);
if (res)
{
{
if (WSAGetLastError () == WSAEINVAL)
{
/* Winsock returns WSAEINVAL if the socket is locally
@ -1093,7 +1093,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
We're faking a valid return value here by creating the
same content in the sockaddr structure as on Linux. */
switch (get_addr_family ())
{
{
case AF_INET:
res = 0;
*namelen = sizeof (struct sockaddr_in);
@ -1107,7 +1107,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
break;
}
if (!res)
{
{
memset (name, 0, *namelen);
name->sa_family = get_addr_family ();
}
@ -1262,7 +1262,7 @@ fhandler_socket::send_internal (struct _WSABUF *wsabuf, DWORD wsacnt, int flags,
if ((res = WSASendTo (get_socket (), wsabuf, wsacnt, &ret,
flags & MSG_WINMASK, to, tolen, NULL, NULL))
&& (err = WSAGetLastError ()) == WSAEWOULDBLOCK)
{
{
LOCK_EVENTS;
wsock_events->events &= ~FD_WRITE;
UNLOCK_EVENTS;
@ -1303,7 +1303,7 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags,
WSABUF wsabuf = { len, (char *) ptr };
return send_internal (&wsabuf, 1, flags,
(to ? (const struct sockaddr *) &sst : NULL), tolen);
(to ? (const struct sockaddr *) &sst : NULL), tolen);
}
int
@ -1328,7 +1328,7 @@ fhandler_socket::sendmsg (const struct msghdr *msg, int flags)
}
return send_internal (wsabuf, msg->msg_iovlen, flags,
(struct sockaddr *) msg->msg_name, msg->msg_namelen);
(struct sockaddr *) msg->msg_name, msg->msg_namelen);
}
int
@ -1441,11 +1441,11 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
if (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
{
ifc.ifc_len = ifcp->ifc_len / sizeof (struct __old_ifreq)
* sizeof (struct ifreq);
* sizeof (struct ifreq);
ifc.ifc_buf = (caddr_t) alloca (ifc.ifc_len);
}
else
{
{
ifc.ifc_len = ifcp->ifc_len;
ifc.ifc_buf = ifcp->ifc_buf;
}
@ -1453,7 +1453,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
if (res)
debug_printf ("error in get_ifconf");
if (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
{
{
struct __old_ifreq *ifr = (struct __old_ifreq *) ifcp->ifc_buf;
for (ifrp = ifc.ifc_req;
(caddr_t) ifrp < ifc.ifc_buf + ifc.ifc_len;
@ -1467,7 +1467,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
* sizeof (struct __old_ifreq);
}
else
ifcp->ifc_len = ifc.ifc_len;
ifcp->ifc_len = ifc.ifc_len;
break;
case OLD_SIOCGIFFLAGS:
case OLD_SIOCGIFADDR:
@ -1507,7 +1507,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
if (cmd == SIOCGIFFRNDLYNAM)
{
struct ifreq_frndlyname *iff = (struct ifreq_frndlyname *)
alloca (64 * sizeof (struct ifreq_frndlyname));
alloca (64 * sizeof (struct ifreq_frndlyname));
for (int i = 0; i < 64; ++i)
ifc.ifc_req[i].ifr_frndlyname = &iff[i];
}
@ -1573,7 +1573,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
async_io (*(int *) p != 0);
/* If async_io is switched off, revert the event handling. */
if (*(int *) p == 0)
WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK);
WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK);
break;
case FIONREAD:
res = ioctlsocket (get_socket (), FIONREAD, (unsigned long *) p);
@ -1582,14 +1582,14 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
break;
default:
/* Sockets are always non-blocking internally. So we just note the
state here. */
state here. */
if (cmd == FIONBIO)
{
syscall_printf ("socket is now %sblocking",
*(int *) p ? "non" : "");
set_nonblocking (*(int *) p);
res = 0;
}
}
else
res = ioctlsocket (get_socket (), cmd, (unsigned long *) p);
break;

View File

@ -176,7 +176,7 @@ static int glob1(Char *, glob_t *, size_t *);
static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
static int globextend(const Char *, glob_t *, size_t *);
static const Char *
static const Char *
globtilde(const Char *, Char *, size_t, glob_t *);
static int globexp1(const Char *, glob_t *, size_t *);
static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
@ -397,8 +397,8 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
return pattern;
/*
* Copy up to the end of the string or /
/*
* Copy up to the end of the string or /
*/
eb = &patbuf[patbuf_len - 1];
for (p = pattern + 1, h = (char *) patbuf;

View File

@ -329,7 +329,7 @@ MapView9x (HANDLE h, void *addr, size_t len, DWORD openflags,
/* Try mapping using the given address first, even if it's NULL.
If it failed, and addr was not NULL and flags is not MAP_FIXED,
try again with NULL address.
Note: Retrying the mapping might be unnecessary, now that mmap64 checks
for a valid memory area first. */
if (!addr)
@ -361,7 +361,7 @@ MapViewNT (HANDLE h, void *addr, size_t len, DWORD openflags,
/* Try mapping using the given address first, even if it's NULL.
If it failed, and addr was not NULL and flags is not MAP_FIXED,
try again with NULL address.
Note: Retrying the mapping might be unnecessary, now that mmap64 checks
for a valid memory area first. */
ret = NtMapViewOfSection (h, GetCurrentProcess (), &base, 0, commitsize,
@ -914,7 +914,7 @@ map::del_list (unsigned i)
a system call indicates that the application buffer passed had an
invalid virtual address to avoid any performance impact in non-noreserve
cases.
Check if the address range is all within noreserve mmap regions. If so,
call VirtualAlloc to commit the pages and return MMAP_NORESERVE_COMMITED
on success. If the page has __PROT_ATTACH (SUSv3 memory protection
@ -938,7 +938,7 @@ mmap_is_attached_or_noreserve (void *addr, size_t len)
if (map_list == NULL)
return MMAP_NONE;
while (len > 0)
while (len > 0)
{
caddr_t u_addr;
DWORD u_len;
@ -1037,7 +1037,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
to enable remapping of formerly mapped pages. If no matching
free pages exist, check addr again, this time for the real alignment. */
checkpagesize = wincap.has_mmap_alignment_bug () ?
getsystempagesize () : pagesize;
getsystempagesize () : pagesize;
if (fixed (flags) && ((uintptr_t) addr % checkpagesize))
{
set_errno (EINVAL);
@ -1129,7 +1129,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
}
if (fh->fstat (&st))
{
{
__seterrno ();
goto out;
}
@ -1235,7 +1235,7 @@ go_ahead:
PVOID newaddr = VirtualAlloc (addr, orig_len, MEM_TOP_DOWN | MEM_RESERVE,
PAGE_READWRITE);
if (!newaddr)
{
{
/* If addr is not NULL, but MAP_FIXED isn't given, allow the OS
to choose. */
if (addr && !fixed (flags))
@ -1248,7 +1248,7 @@ go_ahead:
}
}
if (!VirtualFree (newaddr, 0, MEM_RELEASE))
{
{
__seterrno ();
goto out;
}
@ -1739,7 +1739,7 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
*/
DWORD protect = gen_protect (prot, flags);
DWORD alloc_type = MEM_TOP_DOWN | MEM_RESERVE
| (noreserve (flags) ? 0 : MEM_COMMIT);
| (noreserve (flags) ? 0 : MEM_COMMIT);
base = VirtualAlloc (*addr, len, alloc_type, protect);
if (!base && addr && !fixed (flags))
base = VirtualAlloc (NULL, len, alloc_type, protect);

View File

@ -553,7 +553,7 @@ cygwin_socket (int af, int type, int protocol)
debug_printf ("socket (%d, %d, %d)", af, type, protocol);
soc = socket (af == AF_LOCAL ? AF_INET : af, type,
af == AF_LOCAL ? 0 : protocol);
af == AF_LOCAL ? 0 : protocol);
if (soc == INVALID_SOCKET)
{
@ -1128,11 +1128,11 @@ getdomainname (char *domain, size_t len)
/* Vista/Longhorn: unicast address has additional OnLinkPrefixLength member. */
typedef struct _IP_ADAPTER_UNICAST_ADDRESS_LH {
_ANONYMOUS_UNION union {
ULONGLONG Alignment;
_ANONYMOUS_UNION struct {
ULONG Length;
DWORD Flags;
} DUMMYSTRUCTNAME;
ULONGLONG Alignment;
_ANONYMOUS_UNION struct {
ULONG Length;
DWORD Flags;
} DUMMYSTRUCTNAME;
} DUMMYUNIONNAME;
struct _IP_ADAPTER_UNICAST_ADDRESS_VISTA *Next;
SOCKET_ADDRESS Address;
@ -1231,7 +1231,7 @@ ip_addr_prefix (PIP_ADAPTER_UNICAST_ADDRESS pua, PIP_ADAPTER_PREFIX pap)
/* Prior to Vista, the loopback prefix is not available. */
if (IN_LOOPBACK (((struct sockaddr_in *)
pua->Address.lpSockaddr)->sin_addr.s_addr))
return 8;
return 8;
for ( ; pap; pap = pap->Next)
if (in_are_prefix_equal (
&((struct sockaddr_in *) pua->Address.lpSockaddr)->sin_addr,
@ -1285,7 +1285,7 @@ get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa_ret, ULONG family)
if (ret != ERROR_SUCCESS)
{
if (pa0)
free (pa0);
free (pa0);
*pa_ret = NULL;
return false;
}
@ -1303,7 +1303,7 @@ static inline short
convert_ifr_flags (u_long ws_flags)
{
return (ws_flags & (WS_IFF_UP | WS_IFF_BROADCAST))
| ((ws_flags & (WS_IFF_LOOPBACK | WS_IFF_POINTTOPOINT)) << 1)
| ((ws_flags & (WS_IFF_LOOPBACK | WS_IFF_POINTTOPOINT)) << 1)
| ((ws_flags & WS_IFF_MULTICAST) << 8);
}
@ -1323,7 +1323,7 @@ get_xp_ifconf (SOCKET s, struct ifconf *ifc, int what)
if (!get_adapters_addresses (&pa0, AF_INET))
goto done;
for (pap = pa0; pap; pap = pap->Next)
for (pua = pap->FirstUnicastAddress; pua; pua = pua->Next)
++cnt;
@ -1332,19 +1332,19 @@ get_xp_ifconf (SOCKET s, struct ifconf *ifc, int what)
space for one more INTERFACE_INFO structure here. */
iie = (LPINTERFACE_INFO) alloca ((cnt + 1) * sizeof (INTERFACE_INFO));
if (WSAIoctl (s, SIO_GET_INTERFACE_LIST, NULL, 0, iie,
(cnt + 1) * sizeof (INTERFACE_INFO), &size, NULL, NULL))
(cnt + 1) * sizeof (INTERFACE_INFO), &size, NULL, NULL))
{
set_winsock_errno ();
cnt = 0;
goto done;
}
struct ifreq *ifr = ifc->ifc_req;
for (pap = pa0; pap; pap = pap->Next)
{
int idx = 0;
for (pua = pap->FirstUnicastAddress; pua; pua = pua->Next)
{
{
int iinf_idx;
for (iinf_idx = 0; iinf_idx < cnt; ++iinf_idx)
if (iie[iinf_idx].iiAddress.AddressIn.sin_addr.s_addr
@ -1401,7 +1401,7 @@ get_xp_ifconf (SOCKET s, struct ifconf *ifc, int what)
break;
case SIOCGIFMETRIC:
if (wincap.has_gaa_on_link_prefix ())
ifr->ifr_metric = ((PIP_ADAPTER_ADDRESSES_LH) pap)->Ipv4Metric;
ifr->ifr_metric = ((PIP_ADAPTER_ADDRESSES_LH) pap)->Ipv4Metric;
else
ifr->ifr_metric = 1;
break;
@ -1566,7 +1566,7 @@ get_2k_ifconf (struct ifconf *ifc, int what)
if (ifrow->dwOperStatus >= MIB_IF_OPER_STATUS_CONNECTED)
ifr->ifr_flags |= IFF_RUNNING;
}
break;
break;
case SIOCGIFCONF:
case SIOCGIFADDR:
sa = (struct sockaddr_in *) &ifr->ifr_addr;
@ -2132,7 +2132,7 @@ if_indextoname (unsigned ifindex, char *ifname)
&& get_adapters_addresses (&pa0, AF_UNSPEC))
{
for (pap = pa0; pap; pap = pap->Next)
if (ifindex == pap->IfIndex)
if (ifindex == pap->IfIndex)
{
name = strcpy (ifname, pap->AdapterName);
break;
@ -2160,19 +2160,19 @@ if_nameindex (void)
{
int cnt = 0;
for (pap = pa0; pap; pap = pap->Next)
++cnt;
++cnt;
iflist = (struct if_nameindex *)
malloc ((cnt + 1) * sizeof (struct if_nameindex)
+ cnt * IF_NAMESIZE);
if (!iflist)
set_errno (ENOBUFS);
else
{
{
ifnamelist = (char (*)[IF_NAMESIZE]) (iflist + cnt + 1);
for (pap = pa0, cnt = 0; pap; pap = pap->Next)
{
for (int i = 0; i < cnt; ++i)
if (iflist[i].if_index == (pap->IfIndex ?: pap->Ipv6IfIndex))
if (iflist[i].if_index == (pap->IfIndex ?: pap->Ipv6IfIndex))
goto outer_loop;
iflist[cnt].if_index = pap->IfIndex ?: pap->Ipv6IfIndex;
strcpy (iflist[cnt].if_name = ifnamelist[cnt], pap->AdapterName);
@ -2255,7 +2255,7 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa)
{
ret = fh->bind (sa, salen);
if (!ret || (get_errno () != EADDRINUSE && get_errno () != EINVAL))
return ret;
return ret;
}
LONG myport;
@ -2584,7 +2584,7 @@ inet_pton4 (const char *src, u_char *dst)
const char *pch;
if ((pch = strchr(digits, ch)) != NULL)
{
{
u_int ret = *tp * 10 + (pch - digits);
if (ret > 255)
@ -2598,7 +2598,7 @@ inet_pton4 (const char *src, u_char *dst)
}
}
else if (ch == '.' && saw_digit)
{
{
if (octets == 4)
return (0);
*++tp = 0;
@ -2654,7 +2654,7 @@ inet_pton6 (const char *src, u_char *dst)
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
pch = strchr((xdigits = xdigits_u), ch);
if (pch != NULL)
{
{
val <<= 4;
val |= (pch - xdigits);
if (val > 0xffff)
@ -2663,7 +2663,7 @@ inet_pton6 (const char *src, u_char *dst)
continue;
}
if (ch == ':')
{
{
curtok = src;
if (!saw_xdigit)
{
@ -2681,7 +2681,7 @@ inet_pton6 (const char *src, u_char *dst)
continue;
}
if (ch == '.' && ((tp + INADDRSZ) <= endp) && inet_pton4(curtok, tp) > 0)
{
{
tp += INADDRSZ;
saw_xdigit = 0;
break; /* '\0' was seen by inet_pton4(). */
@ -2705,7 +2705,7 @@ inet_pton6 (const char *src, u_char *dst)
int i;
for (i = 1; i <= n; i++)
{
{
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
}
@ -2806,14 +2806,14 @@ inet_ntop6 (const u_char *src, char *dst, size_t size)
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
{
if (words[i] == 0)
{
{
if (cur.base == -1)
cur.base = i, cur.len = 1;
else
cur.len++;
}
else
{
{
if (cur.base != -1)
{
if (best.base == -1 || cur.len > best.len)
@ -2838,7 +2838,7 @@ inet_ntop6 (const u_char *src, char *dst, size_t size)
{
/* Are we inside the best run of 0x00's? */
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
{
{
if (i == best.base)
*tp++ = ':';
continue;
@ -3040,11 +3040,11 @@ ga_dup (struct addrinfo *ai, bool v4mapped)
}
nai->ai_addrlen = v4mapped ? sizeof (struct sockaddr_in6) : ai->ai_addrlen;
if ((nai->ai_addr = (struct sockaddr *) malloc (v4mapped
? sizeof (struct sockaddr_in6)
? sizeof (struct sockaddr_in6)
: ai->ai_addrlen)) == NULL)
{
if (nai->ai_canonname)
free (nai->ai_canonname);
free (nai->ai_canonname);
free (nai);
return NULL;
}
@ -3088,11 +3088,11 @@ ga_duplist (struct addrinfo *ai, bool v4mapped)
for (; ai; ai = ai->ai_next, nai = tmp)
{
if (!(tmp = ga_dup (ai, v4mapped)))
goto bad;
goto bad;
if (!nai0)
nai0 = tmp;
nai0 = tmp;
if (nai)
nai->ai_next = tmp;
nai->ai_next = tmp;
}
return nai0;
@ -3899,14 +3899,14 @@ load_ipv6_funcs ()
len = strlen (lib_name);
strcpy (lib_name + len, "\\ws2_32.dll");
if ((lib = LoadLibrary (lib_name)))
{
{
if (get_ipv6_funcs (lib))
goto out;
FreeLibrary (lib);
}
strcpy (lib_name + len, "\\wship6.dll");
if ((lib = LoadLibrary (lib_name)))
{
{
if (get_ipv6_funcs (lib))
goto out;
FreeLibrary (lib);
@ -3940,7 +3940,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
in ai_flags slip through and just ignore unknowen values. So we have
to check manually here. */
if (hints && (hints->ai_flags
& ~(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ALL
& ~(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ALL
| AI_NUMERICSERV | AI_ADDRCONFIG | AI_V4MAPPED)))
return EAI_BADFLAGS;
/* AI_NUMERICSERV is not supported in our replacement getaddrinfo, nor
@ -3964,7 +3964,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
behaviour, the AI_ALL flag has to be set. */
if (wincap.supports_all_posix_ai_flags ()
&& hints && hints->ai_family == PF_UNSPEC)
{
{
nhints = *hints;
hints = &nhints;
nhints.ai_flags |= AI_ALL;
@ -3972,7 +3972,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
int ret = w32_to_gai_err (getaddrinfo (hostname, servname, hints, res));
/* Always copy over to self-allocated memory. */
if (!ret)
{
{
dupres = ga_duplist (*res, false);
freeaddrinfo (*res);
*res = dupres;
@ -3980,7 +3980,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
return EAI_MEMORY;
}
/* AI_V4MAPPED and AI_ALL are not supported prior to Vista. So, what
we do here is to emulate AI_V4MAPPED. If no IPv6 addresses are
we do here is to emulate AI_V4MAPPED. If no IPv6 addresses are
returned, or the AI_ALL flag is set, we try with AF_INET again, and
convert the returned IPv4 addresses into v4-in-v6 entries. This
is done in ga_dup if the v4mapped flag is set. */
@ -4006,7 +4006,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
return EAI_MEMORY;
}
/* If a list of v6 addresses exists, append the v4-in-v6 address
list. Otherwise just return the v4-in-v6 address list. */
list. Otherwise just return the v4-in-v6 address list. */
if (!ret)
{
struct addrinfo *ptr;
@ -4040,7 +4040,7 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
To avoid this strange behaviour, we check manually, if the port number
is 0. If so, set the NI_NUMERICSERV flag to avoid this problem. */
switch (sa->sa_family)
{
{
case AF_INET:
if (((struct sockaddr_in *) sa)->sin_port == 0)
flags |= NI_NUMERICSERV;
@ -4053,7 +4053,7 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
int ret = w32_to_gai_err (getnameinfo (sa, salen, host, hostlen, serv,
servlen, flags));
if (ret)
set_winsock_errno ();
set_winsock_errno ();
return ret;
}
return ipv4_getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
@ -4129,7 +4129,7 @@ in6_are_prefix_equal (struct in6_addr *p1, struct in6_addr *p2, int len)
/* sanity check */
if (0 > len || len > 128)
return 0;
bytelen = len / 8;
bitlen = len % 8;

View File

@ -67,12 +67,12 @@ read_ea (HANDLE hdl, const char *file, const char *attrname, char *attrbuf,
== INVALID_HANDLE_VALUE)
{
debug_printf ("Opening %s for querying EA %s failed, %E",
file, attrname);
file, attrname);
goto out;
}
status = NtQueryEaFile (h, &io, fea, flen, FALSE, gea, glen, NULL, TRUE);
if (NT_SUCCESS (status) || !hdl)
break;
break;
debug_printf ("1. chance, %x = NtQueryEaFile (%s, %s), Win32 error %d",
status, file, attrname, RtlNtStatusToDosError (status));
hdl = NULL;
@ -96,7 +96,7 @@ read_ea (HANDLE hdl, const char *file, const char *attrname, char *attrbuf,
out:
debug_printf ("%d = read_ea (%x, %s, %s, %x, %d)", ret, hdl, file, attrname,
attrbuf, len);
attrbuf, len);
return ret;
}
@ -147,12 +147,12 @@ write_ea (HANDLE hdl, const char *file, const char *attrname,
== INVALID_HANDLE_VALUE)
{
debug_printf ("Opening %s for setting EA %s failed, %E",
file, attrname);
file, attrname);
goto out;
}
status = NtSetEaFile (h, &io, fea, flen);
if (NT_SUCCESS (status) || !hdl)
break;
break;
debug_printf ("1. chance, %x = NtQueryEaFile (%s, %s), Win32 error %d",
status, file, attrname, RtlNtStatusToDosError (status));
hdl = NULL;
@ -167,6 +167,6 @@ write_ea (HANDLE hdl, const char *file, const char *attrname,
out:
debug_printf ("%d = write_ea (%x, %s, %s, %x, %d)", ret, hdl, file, attrname,
attrbuf, len);
attrbuf, len);
return ret;
}

View File

@ -3118,7 +3118,7 @@ symlink_info::check_reparse_point (const char *path, HANDLE h)
char srcbuf[CYG_MAX_PATH + 6];
if (!DeviceIoControl (h, FSCTL_GET_REPARSE_POINT, NULL, 0, (LPVOID) rp,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &size, NULL))
MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &size, NULL))
{
debug_printf ("DeviceIoControl(FSCTL_GET_REPARSE_POINT) failed, %E");
set_error (EIO);
@ -3143,13 +3143,13 @@ symlink_info::check_reparse_point (const char *path, HANDLE h)
else if (rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
if (rp->SymbolicLinkReparseBuffer.PrintNameLength == 0)
{
{
/* Likely a volume mount point. Not treated as symlink. */
goto close_it;
}
if (rp->MountPointReparseBuffer.SubstituteNameLength
> 2 * (CYG_MAX_PATH + 6))
{
{
debug_printf ("Symlink name too long");
set_error (EIO);
goto close_it;
@ -3207,7 +3207,7 @@ symlink_info::posixify (char *srcbuf)
if (srcbuf[1] == '\\') /* UNC path */
slashify (srcbuf, contents, 0);
else /* Paths starting with \ are current drive relative. */
{
{
char cvtbuf[CYG_MAX_PATH + 6];
strncpy (cvtbuf, cygheap->cwd.win32, 2);
@ -3470,7 +3470,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
/* Reparse points are potentially symlinks. */
if (fileattr & FILE_ATTRIBUTE_REPARSE_POINT)
sym_check = 3;
sym_check = 3;
/* This is the old Cygwin method creating symlinks: */
/* A symlink will have the `system' file attribute. */
@ -4235,15 +4235,15 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
{
cwd_lock.acquire ();
if (doit)
{
{
if (keep_in_sync ())
{
/* If a Cygwin application called cygwin_internal(CW_SYNC_WINENV),
then it's about to call native Windows functions. This also
then it's about to call native Windows functions. This also
sets the keep_in_sync flag so that we actually chdir into the
native directory on 9x to avoid confusion. */
if (!SetCurrentDirectory (win32_cwd))
{
{
__seterrno ();
goto out;
}
@ -4283,7 +4283,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
if (wincap.can_open_directories ())
{
HANDLE h = CreateFile (win32_cwd, FILE_TRAVERSE,
wincap.shared (), NULL, OPEN_EXISTING,
wincap.shared (), NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (h == INVALID_HANDLE_VALUE)
{
@ -4310,7 +4310,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
CloseHandle (h);
}
}
}
}
}
/* If there is no win32 path or it has the form c:xxx, get the value */
if (!win32_cwd || (isdrive (win32_cwd) && win32_cwd[2] != '\\'))

View File

@ -399,7 +399,7 @@ commune_process (void *arg)
if (process_sync) // FIXME: this test shouldn't be necessary
ProtectHandle (process_sync);
lock_process now (false);
lock_process now ();
if (si._si_commune._si_code & PICOM_EXTRASTR)
si._si_commune._si_str = (char *) (&si + 1);

View File

@ -200,13 +200,13 @@ cygsidlist::free_sids ()
BOOL
cygsidlist::add (const PSID nsi, bool well_known)
{
if (contains (nsi))
{
if (contains (nsi))
return TRUE;
if (cnt >= maxcnt)
{
cygsid *tmp = new cygsid [2 * maxcnt];
if (!tmp)
if (!tmp)
return FALSE;
maxcnt *= 2;
for (int i = 0; i < cnt; ++i)
@ -214,12 +214,12 @@ cygsidlist::add (const PSID nsi, bool well_known)
delete [] sids;
sids = tmp;
}
if (well_known)
if (well_known)
sids[cnt++] *= nsi;
else
sids[cnt++] = nsi;
return TRUE;
}
}
bool
get_sids_info (cygpsid owner_sid, cygpsid group_sid, __uid32_t * uidret, __gid32_t * gidret)
@ -274,7 +274,7 @@ PSECURITY_DESCRIPTOR
security_descriptor::realloc (size_t nsize)
{
PSECURITY_DESCRIPTOR tmp;
if (!(tmp = (PSECURITY_DESCRIPTOR) ::realloc (psd, nsize)))
return NULL;
sd_size = nsize;

View File

@ -232,7 +232,7 @@ get_logon_server (const char *domain, char *server, WCHAR *wserver,
/* NT4 w/o DSClient */
sys_mbstowcs (wdomain, domain, INTERNET_MAX_HOST_NAME_LENGTH + 1);
if (rediscovery)
dret = NetGetAnyDCName (NULL, wdomain, (LPBYTE *) &buf);
dret = NetGetAnyDCName (NULL, wdomain, (LPBYTE *) &buf);
else
dret = NetGetDCName (NULL, wdomain, (LPBYTE *) &buf);
if (dret == NERR_Success)
@ -605,7 +605,7 @@ get_system_priv_list (cygsidlist &grp_list, size_t &size)
{
const LUID *priv;
size = sizeof (ULONG)
+ SYSTEM_PRIVILEGES_COUNT * sizeof (LUID_AND_ATTRIBUTES);
+ SYSTEM_PRIVILEGES_COUNT * sizeof (LUID_AND_ATTRIBUTES);
PTOKEN_PRIVILEGES privs = (PTOKEN_PRIVILEGES) malloc (size);
if (!privs)
{
@ -657,7 +657,7 @@ get_priv_list (LSA_HANDLE lsa, cygsid &usersid, cygsidlist &grp_list,
DWORD tmp_count;
sys_wcstombs (buf, sizeof (buf),
privstrs[i].Buffer, privstrs[i].Length / 2);
privstrs[i].Buffer, privstrs[i].Length / 2);
if (!(priv = privilege_luid_by_name (buf)))
continue;
@ -1097,7 +1097,7 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
for (int i = 0; i < non_well_known_cnt; ++i)
{
if ((tmpidx = tmp_gsids.next_non_well_known_sid (tmpidx)) < 0)
break;
break;
gsids->Groups[i].Sid = sids_offset;
gsids->Groups[i].Attributes = SE_GROUP_MANDATORY
| SE_GROUP_ENABLED_BY_DEFAULT
@ -1105,7 +1105,7 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
/* Mark logon SID as logon SID :) */
if (wincap.needs_logon_sid_in_sid_list ()
&& tmp_gsids.sids[tmpidx] == fake_logon_sid)
gsids->Groups[i].Attributes += SE_GROUP_LOGON_ID;
gsids->Groups[i].Attributes += SE_GROUP_LOGON_ID;
CopySid (GetLengthSid (tmp_gsids.sids[tmpidx]),
(PSID) ((PBYTE) &authinf->inf + sids_offset),
tmp_gsids.sids[tmpidx]);
@ -1433,26 +1433,26 @@ get_reg_security (HANDLE handle, security_descriptor &sd_ret)
DWORD len = 0;
ret = RegGetKeySecurity ((HKEY) handle,
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, &len);
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, &len);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
{
if (!sd_ret.malloc (len))
set_errno (ENOMEM);
set_errno (ENOMEM);
else
ret = RegGetKeySecurity ((HKEY) handle,
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, &len);
ret = RegGetKeySecurity ((HKEY) handle,
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, &len);
}
if (ret != ERROR_SUCCESS)
{
__seterrno ();
return -1;
}
}
return 0;
}
@ -1462,7 +1462,7 @@ get_nt_object_security (HANDLE handle, SE_OBJECT_TYPE object_type,
{
NTSTATUS ret;
ULONG len = 0;
/* Do not try to use GetSecurityInfo (again), unless we drop NT4 support.
GetSecurityInfo returns the wrong user information when running in
a user session using a token created with NtCreateToken under NT4.
@ -1476,25 +1476,25 @@ get_nt_object_security (HANDLE handle, SE_OBJECT_TYPE object_type,
convert pseudo HKEY values to real handles. */
if (object_type == SE_REGISTRY_KEY)
return get_reg_security (handle, sd_ret);
ret = NtQuerySecurityObject (handle,
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, len, &len);
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, len, &len);
if (ret == STATUS_BUFFER_TOO_SMALL)
{
if (!sd_ret.malloc (len))
set_errno (ENOMEM);
set_errno (ENOMEM);
else
ret = NtQuerySecurityObject (handle,
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, len, &len);
ret = NtQuerySecurityObject (handle,
DACL_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| OWNER_SECURITY_INFORMATION,
sd_ret, len, &len);
}
if (ret != STATUS_SUCCESS)
{
{
__seterrno_from_nt_status (ret);
return -1;
}

View File

@ -3,9 +3,6 @@
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006 Red Hat, Inc.
Written by Christopher Faylor of Cygnus Solutions
cgf@cygnus.com
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
@ -1316,7 +1313,7 @@ thread_socket (void *arg)
goto out;
case WAIT_OBJECT_0:
if (!i) /* Socket event set. */
goto out;
goto out;
break;
case WAIT_TIMEOUT:
default:
@ -1405,9 +1402,9 @@ socket_cleanup (select_record *, select_stuff *stuff)
ResetEvent (si->w4[0]);
stuff->device_specific_socket = NULL;
if (si->ser_num)
free (si->ser_num);
free (si->ser_num);
if (si->w4)
free (si->w4);
free (si->w4);
delete si;
}
select_printf ("returning");

View File

@ -1,7 +1,7 @@
/* sigproc.cc: inter/intra signal and sub process handler
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006 Red Hat, Inc.
2006, 2007 Red Hat, Inc.
Written by Christopher Faylor

View File

@ -253,10 +253,10 @@ unlink_nt (path_conv &win32_name, bool setattrs)
is opened "delete on close", the rename operation in try_to_bin fails
with STATUS_ACCESS_DENIED. So directories must be deleted using
NtSetInformationFile, class FileDispositionInformation, which works fine.
Correction, moving a directory opened with delete-on-close fails ONLY
on XP. Note to myself: Never take anything for granted on Windows!
Don't try "delete on close" if the file is on a remote share. If two
processes have open handles on a file and one of them calls unlink, then
it happens that the file is removed from the remote share even though the