* pinfo.cc (commune_process): Use default argument to lock_process.
* sigproc.cc: Update copyright.
* select.cc: Ditto.
+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
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
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. */
}
}
while (--c > min_c && *c != '\\')
- ;
+ ;
}
return root_path;
? 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:
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:
return 1;
case _PC_VDISABLE:
if (is_tty ())
- return _POSIX_VDISABLE;
+ return _POSIX_VDISABLE;
set_errno (EINVAL);
break;
case _PC_ASYNC_IO:
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:
toadd = tmp + 1;
else if (dev_state->metabit)
{
- tmp[1] |= 0x80;
+ tmp[1] |= 0x80;
toadd = tmp + 1;
}
else
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;
{
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))
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;
res = 0;
}
else
- {
+ {
_off64_t prev_loc = lseek (0, SEEK_CUR);
if (lseek (length, SEEK_SET) >= 0)
{
{
rc = !(err = unlink_nt (pc, pc.has_attribute (FILE_ATTRIBUTE_READONLY)));
if (err)
- SetLastError (err);
+ SetLastError (err);
}
else
rc = RemoveDirectory (get_win32_name ());
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,
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
{
d_cachepos (dir) = 0;
for (int cnt = 0; cnt < dir->__d_position; ++cnt)
- {
+ {
if (d_cachepos (dir) == 0)
{
status = NtQueryDirectoryFile (dir->__handle, NULL, NULL,
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
{
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
void
fhandler_registry::set_name (path_conv &in_pc)
-{
+{
if (strncasematch (in_pc.normalized_path, "/proc/registry32", 16))
{
wow64 = KEY_WOW64_32KEY;
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
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);
}
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))
if (!(WSAEnumNetworkEvents (get_socket (), wsock_evt, &evts)))
{
if (evts.lNetworkEvents)
- {
+ {
LOCK_EVENTS;
wsock_events->events |= evts.lNetworkEvents;
events_now = (wsock_events->events & event_mask);
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;
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,
{
res = ::getsockname (get_socket (), name, namelen);
if (res)
- {
+ {
if (WSAGetLastError () == WSAEINVAL)
{
/* Winsock returns WSAEINVAL if the socket is locally
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);
break;
}
if (!res)
- {
+ {
memset (name, 0, *namelen);
name->sa_family = get_addr_family ();
}
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;
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
}
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
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;
}
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;
* sizeof (struct __old_ifreq);
}
else
- ifcp->ifc_len = ifc.ifc_len;
+ ifcp->ifc_len = ifc.ifc_len;
break;
case OLD_SIOCGIFFLAGS:
case OLD_SIOCGIFADDR:
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];
}
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);
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;
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 *);
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;
/* 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)
/* 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,
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
if (map_list == NULL)
return MMAP_NONE;
- while (len > 0)
+ while (len > 0)
{
caddr_t u_addr;
DWORD u_len;
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);
}
if (fh->fstat (&st))
- {
+ {
__seterrno ();
goto out;
}
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))
}
}
if (!VirtualFree (newaddr, 0, MEM_RELEASE))
- {
+ {
__seterrno ();
goto out;
}
*/
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);
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)
{
/* 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;
/* 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,
if (ret != ERROR_SUCCESS)
{
if (pa0)
- free (pa0);
+ free (pa0);
*pa_ret = NULL;
return false;
}
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);
}
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;
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
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;
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;
&& 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;
{
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);
{
ret = fh->bind (sa, salen);
if (!ret || (get_errno () != EADDRINUSE && get_errno () != EINVAL))
- return ret;
+ return ret;
}
LONG myport;
const char *pch;
if ((pch = strchr(digits, ch)) != NULL)
- {
+ {
u_int ret = *tp * 10 + (pch - digits);
if (ret > 255)
}
}
else if (ch == '.' && saw_digit)
- {
+ {
if (octets == 4)
return (0);
*++tp = 0;
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)
continue;
}
if (ch == ':')
- {
+ {
curtok = src;
if (!saw_xdigit)
{
continue;
}
if (ch == '.' && ((tp + INADDRSZ) <= endp) && inet_pton4(curtok, tp) > 0)
- {
+ {
tp += INADDRSZ;
saw_xdigit = 0;
break; /* '\0' was seen by inet_pton4(). */
int i;
for (i = 1; i <= n; i++)
- {
+ {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
}
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)
{
/* 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;
}
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;
}
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;
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);
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
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;
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;
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. */
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;
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;
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);
/* sanity check */
if (0 > len || len > 128)
return 0;
-
+
bytelen = len / 8;
bitlen = len % 8;
== 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;
out:
debug_printf ("%d = read_ea (%x, %s, %s, %x, %d)", ret, hdl, file, attrname,
- attrbuf, len);
+ attrbuf, len);
return ret;
}
== 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;
out:
debug_printf ("%d = write_ea (%x, %s, %s, %x, %d)", ret, hdl, file, attrname,
- attrbuf, len);
+ attrbuf, len);
return ret;
}
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);
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;
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);
/* 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. */
{
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;
}
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)
{
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] != '\\'))
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);
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)
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)
security_descriptor::realloc (size_t nsize)
{
PSECURITY_DESCRIPTOR tmp;
-
+
if (!(tmp = (PSECURITY_DESCRIPTOR) ::realloc (psd, nsize)))
return NULL;
sd_size = nsize;
/* 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)
{
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)
{
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;
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
/* 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]);
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;
}
{
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.
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;
}
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
goto out;
case WAIT_OBJECT_0:
if (!i) /* Socket event set. */
- goto out;
+ goto out;
break;
case WAIT_TIMEOUT:
default:
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");
/* 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
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