* cygheap.cc (creturn): Reorganize to avoid a new compiler warning/error.

* dtable.cc (handle_to_fn): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::scroll_screen): Ditto.
(dev_console::set_color): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
* fhandler_tape.cc (mtinfo_drive::get_status): Ditto.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* mmap.cc (msync): Ditto.
* pipe.cc (pipesync::pipesync): Ditto.
* sec_acl.cc (getace): Ditto.
* sec_auth.cc (create_token): Ditto.
(lsaauth): Ditto.
* select.cc (peek_pipe): Ditto.
* spawn.cc (av::fixup): Ditto.
* syscalls.cc (popen): Ditto.
* tty.cc (tty::init_session): Ditto.
* uinfo.cc (pwdgrp::load): Ditto.
* fhandler.cc (fhandler_base::setup_overlapped): Ditto.
(fhandler_base::wait_overlapped): Rename second use of res variable to wres or
errors are not returned correctly.
* dcrt0.cc: Remove obsolete variable.
* dll_init.cc (release_upto): Fix typo involving incorrect use of '|'.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a compiler
warning regarding coercing type-punned variables.
(fhandler_base::fstat_by_name): Ditto.  fhandler_fifo.cc
(fhandler_fifo::open_nonserver): Fix = vs.  == typo.
(fhandler_fifo::wait): Add all conditions to switch statement to avoid a
compiler warning.
* fhandler_process.cc: Avoid unneeded initialization of variables to zero.
(fhandler_socket::listen): Add braces around initializer.
* flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a compiler
warning.  Fix problem with EWOULDBLOCK error return.
* path.cc (GUID_shortcut): Use braces around struct initializer.
(cygwin_conv_path): Reorganize to avoid a compiler warning.
* random.cc (dummy): Mark variable as volatile to avoid a "used uninitialized"
warning.
* libc/getopt.c: Mark some variables as dllexport although gcc doesn't seem to
do the right thing with them.
* libc/minires-os-if.c (get_registry_dns_items): Coerce some function arguments
to avoid a compiler warning.
This commit is contained in:
Christopher Faylor 2008-09-11 04:34:24 +00:00
parent 0b840b0009
commit 7b9e380f03
29 changed files with 366 additions and 309 deletions

View File

@ -1,3 +1,50 @@
2008-09-11 Christopher Faylor <me+cygwin@cgf.cx>
* cygheap.cc (creturn): Reorganize to avoid a new compiler
warning/error.
* dtable.cc (handle_to_fn): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::scroll_screen): Ditto.
(dev_console::set_color): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
* fhandler_tape.cc (mtinfo_drive::get_status): Ditto.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* mmap.cc (msync): Ditto.
* pipe.cc (pipesync::pipesync): Ditto.
* sec_acl.cc (getace): Ditto.
* sec_auth.cc (create_token): Ditto.
(lsaauth): Ditto.
* select.cc (peek_pipe): Ditto.
* spawn.cc (av::fixup): Ditto.
* syscalls.cc (popen): Ditto.
* tty.cc (tty::init_session): Ditto.
* uinfo.cc (pwdgrp::load): Ditto.
* fhandler.cc (fhandler_base::setup_overlapped): Ditto.
(fhandler_base::wait_overlapped): Rename second use of res variable to
wres or errors are not returned correctly.
* dcrt0.cc: Remove obsolete variable.
* dll_init.cc (release_upto): Fix typo involving incorrect use of '|'.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a
compiler warning regarding coercing type-punned variables.
(fhandler_base::fstat_by_name): Ditto. fhandler_fifo.cc
(fhandler_fifo::open_nonserver): Fix = vs. == typo.
(fhandler_fifo::wait): Add all conditions to switch statement to avoid
a compiler warning.
* fhandler_process.cc: Avoid unneeded initialization of variables to
zero.
(fhandler_socket::listen): Add braces around initializer.
* flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a
compiler warning. Fix problem with EWOULDBLOCK error return.
* path.cc (GUID_shortcut): Use braces around struct initializer.
(cygwin_conv_path): Reorganize to avoid a compiler warning.
* random.cc (dummy): Mark variable as volatile to avoid a "used
uninitialized" warning.
* libc/getopt.c: Mark some variables as dllexport although gcc doesn't
seem to do the right thing with them.
* libc/minires-os-if.c (get_registry_dns_items): Coerce some function
arguments to avoid a compiler warning.
2008-08-27 Christopher Faylor <me+cygwin@cgf.cx>
* fhandler_tty.cc (close_maybe): Check for both types of invalid handle

View File

@ -244,8 +244,9 @@ _crealloc (void *ptr, unsigned size)
inline static void *
creturn (cygheap_types x, cygheap_entry * c, unsigned len, const char *fn = NULL)
{
if (!c)
if (fn)
if (c)
/* nothing to do */;
else if (fn)
api_fatal ("%s would have returned NULL", fn);
else
{

View File

@ -104,9 +104,6 @@ extern "C"
};
bool ignore_case_with_glob;
int __declspec (dllexport) _check_for_executable = true;
#ifdef DEBUGGING
int pinger;
#endif
};
int NO_COPY __api_fatal_exit_val = 1;

View File

@ -79,7 +79,6 @@ void __stdcall modify_handle (const char *, int, HANDLE, const char *, bool)
__attribute__ ((regparm (3)));
void setclexec (HANDLE, HANDLE, bool);
void debug_fixup_after_fork_exec ();
extern int pinger;
struct handle_list
{

View File

@ -269,7 +269,7 @@ release_upto (const PWCHAR name, DWORD here)
(((void *) start < cygheap->user_heap.base
|| (void *) start > cygheap->user_heap.top) &&
((void *) start < (void *) cygheap
| (void *) start > (void *) ((char *) cygheap + CYGHEAPSIZE)))))
|| (void *) start > (void *) ((char *) cygheap + CYGHEAPSIZE)))))
continue;
if (!VirtualFree ((void *) start, 0, MEM_RELEASE))
api_fatal ("couldn't release memory %p(%d) for '%W' alignment, %E\n",

View File

@ -853,27 +853,19 @@ handle_to_fn (HANDLE h, char *posix_fn)
NtQueryObject (h, ObjectNameInformation, &dummy_oni, sizeof (dummy_oni), &len);
if (!len)
{
debug_printf ("NtQueryObject failed 1");
goto unknown;
}
else
{
OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) alloca (len + sizeof (WCHAR));
NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, len, NULL);
if (!NT_SUCCESS (res))
{
debug_printf ("NtQueryObject failed 2");
goto unknown;
}
// NT seems to do this on an unopened file
if (!ntfn->Name.Buffer)
{
else if (!ntfn->Name.Buffer)
debug_printf ("nt->Name.Buffer == NULL");
goto unknown;
}
else
{
WCHAR *w32 = ntfn->Name.Buffer;
size_t w32len = ntfn->Name.Length / sizeof (WCHAR);
w32[w32len] = L'\0';
@ -969,8 +961,9 @@ handle_to_fn (HANDLE h, char *posix_fn)
debug_printf ("derived path '%W', posix '%s'", w32, posix_fn);
return false;
}
}
unknown:
strcpy (posix_fn, unknown_file);
return false;
}

View File

@ -1665,7 +1665,7 @@ fhandler_base::setup_overlapped ()
{
OVERLAPPED *ov = get_overlapped ();
memset (ov, 0, sizeof (*ov));
return ov->hEvent = CreateEvent (&sec_none_nih, true, false, NULL);
return (ov->hEvent = CreateEvent (&sec_none_nih, true, false, NULL));
}
void
@ -1707,9 +1707,9 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
if (&_my_tls == _main_tls)
w4[n++] = signal_arrived;
HANDLE h = writing ? get_output_handle () : get_handle ();
DWORD res = WaitForMultipleObjects (n, w4, false, INFINITE);
DWORD wres = WaitForMultipleObjects (n, w4, false, INFINITE);
err = 0;
switch (res)
switch (wres)
{
case WAIT_OBJECT_0:
debug_printf ("normal read");

View File

@ -261,7 +261,7 @@ fhandler_console::read (void *pv, size_t& buflen)
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
if (input_rec.Event.KeyEvent.bKeyDown &&
virtual_key_code == VK_SCROLL &&
control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED) == LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED
((control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED)) == (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED))
)
{
set_raw_win32_keyboard_mode (!dev_state->raw_win32_keyboard_mode);
@ -568,8 +568,9 @@ fhandler_console::scroll_screen (int x1, int y1, int x2, int y2, int xn, int yn)
/* ScrollConsoleScreenBuffer on Windows 95 is buggy - when scroll distance
* is more than half of screen, filling doesn't work as expected */
if (sr1.Top != sr1.Bottom)
if (dest.Y <= sr1.Top) /* forward scroll */
if (sr1.Top == sr1.Bottom)
/* nothing to do */;
else if (dest.Y <= sr1.Top) /* forward scroll */
clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom);
else /* reverse scroll */
clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1);
@ -895,9 +896,10 @@ dev_console::set_color (HANDLE h)
win_bg |= BACKGROUND_INTENSITY;
if (intensity == INTENSITY_INVISIBLE)
win_fg = win_bg;
else if (intensity == INTENSITY_BOLD)
else if (intensity != INTENSITY_BOLD)
/* nothing to do */;
/* apply foreground intensity only in non-reverse mode! */
if (reverse)
else if (reverse)
win_bg |= BACKGROUND_INTENSITY;
else
win_fg |= FOREGROUND_INTENSITY;

View File

@ -350,11 +350,11 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
pc.file_attributes (fai_buf.fai.BasicInformation.FileAttributes);
return fstat_helper (buf,
fai_buf.fai.BasicInformation.ChangeTime.QuadPart
? *(FILETIME *) &fai_buf.fai.BasicInformation.ChangeTime
: *(FILETIME *) &fai_buf.fai.BasicInformation.LastWriteTime,
*(FILETIME *) &fai_buf.fai.BasicInformation.LastAccessTime,
*(FILETIME *) &fai_buf.fai.BasicInformation.LastWriteTime,
*(FILETIME *) &fai_buf.fai.BasicInformation.CreationTime,
? *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.ChangeTime
: *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastAccessTime,
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.CreationTime,
get_dev (),
fai_buf.fai.StandardInformation.EndOfFile.QuadPart,
fai_buf.fai.StandardInformation.AllocationSize.QuadPart,
@ -417,11 +417,11 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
pc.file_attributes (fdi_buf.fdi.FileAttributes);
return fstat_helper (buf,
fdi_buf.fdi.ChangeTime.QuadPart ?
*(FILETIME *) &fdi_buf.fdi.ChangeTime :
*(FILETIME *) &fdi_buf.fdi.LastWriteTime,
*(FILETIME *) &fdi_buf.fdi.LastAccessTime,
*(FILETIME *) &fdi_buf.fdi.LastWriteTime,
*(FILETIME *) &fdi_buf.fdi.CreationTime,
*(FILETIME *) (void *) &fdi_buf.fdi.ChangeTime :
*(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime,
*(FILETIME *) (void *) &fdi_buf.fdi.LastAccessTime,
*(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime,
*(FILETIME *) (void *) &fdi_buf.fdi.CreationTime,
pc.fs_serial_number (),
fdi_buf.fdi.EndOfFile.QuadPart,
fdi_buf.fdi.AllocationSize.QuadPart,
@ -434,10 +434,10 @@ too_bad:
/* Arbitrary value: 2006-12-01 */
RtlSecondsSince1970ToTime (1164931200L, &ft);
return fstat_helper (buf,
*(FILETIME *) &ft,
*(FILETIME *) &ft,
*(FILETIME *) &ft,
*(FILETIME *) &ft,
*(FILETIME *) (void *) &ft,
*(FILETIME *) (void *) &ft,
*(FILETIME *) (void *) &ft,
*(FILETIME *) (void *) &ft,
0,
0ULL,
-1LL,

View File

@ -1007,8 +1007,9 @@ fhandler_dev_dsp::write (const void *ptr, size_t len)
int len_s = len;
const char *ptr_s = static_cast <const char *> (ptr);
if (!audio_out_)
if (IS_WRITE ())
if (audio_out_)
/* nothing to do */;
else if (IS_WRITE ())
{
debug_printf ("Allocating");
if (!(audio_out_ = new Audio_out))
@ -1046,8 +1047,9 @@ fhandler_dev_dsp::read (void *ptr, size_t& len)
if ((fhandler_dev_dsp *) archetype != this)
return ((fhandler_dev_dsp *)archetype)->read(ptr, len);
if (!audio_in_)
if (IS_READ ())
if (audio_in_)
/* nothing to do */;
else if (IS_READ ())
{
debug_printf ("Allocating");
if (!(audio_in_ = new Audio_in))

View File

@ -34,7 +34,7 @@ fhandler_fifo::open_nonserver (const char *npname, unsigned low_flags,
DWORD mode = 0;
if (low_flags == O_RDONLY)
mode = GENERIC_READ;
else if (low_flags = O_WRONLY)
else if (low_flags == O_WRONLY)
mode = GENERIC_WRITE;
else
mode = GENERIC_READ | GENERIC_WRITE;
@ -131,11 +131,16 @@ fhandler_fifo::wait (bool iswrite)
switch (wait_state)
{
case fifo_wait_for_client:
{
bool res = ConnectNamedPipe (get_handle (), get_overlapped ());
DWORD dummy_bytes;
if (res || GetLastError () == ERROR_PIPE_CONNECTED)
return true;
return wait_overlapped (res, iswrite, &dummy_bytes);
}
case fifo_unknown:
case fifo_wait_for_server:
/* CGF FIXME SOON: test if these really need to be handled. */
default:
break;
}

View File

@ -931,7 +931,7 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
{
++*vmrss;
unsigned flags = mwsl->WorkingSetList[i] & 0x0FFF;
if (flags & (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE) == (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE))
if ((flags & (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE)) == (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE))
++*vmlib;
else if (flags & WSLE_PAGE_SHAREABLE)
++*vmshare;

View File

@ -408,9 +408,9 @@ fhandler_socket::af_local_set_secret (char *buf)
#define LOCK_EVENTS WaitForSingleObject (wsock_mtx, INFINITE)
#define UNLOCK_EVENTS ReleaseMutex (wsock_mtx)
static wsa_event wsa_events[NUM_SOCKS] __attribute__((section (".cygwin_dll_common"), shared)) = { 0 };
static wsa_event wsa_events[NUM_SOCKS] __attribute__((section (".cygwin_dll_common"), shared));
static LONG socket_serial_number __attribute__((section (".cygwin_dll_common"), shared)) = 0;
static LONG socket_serial_number __attribute__((section (".cygwin_dll_common"), shared));
static HANDLE wsa_slot_mtx;
@ -1091,7 +1091,7 @@ fhandler_socket::listen (int backlog)
sin6_family: AF_INET6,
sin6_port: 0,
sin6_flowinfo: 0,
sin6_addr: IN6ADDR_ANY_INIT,
sin6_addr: {{IN6ADDR_ANY_INIT}},
sin6_scope_id: 0
};
if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6))

View File

@ -801,8 +801,9 @@ mtinfo_drive::get_status (HANDLE mt, struct mtget *get)
get->mt_fileno = part (partition)->file;
get->mt_blkno = part (partition)->fblock;
if (get->mt_blkno == 0)
if (get->mt_fileno == 0)
if (get->mt_blkno != 0)
/* nothing to do */;
else if (get->mt_fileno == 0)
get->mt_gstat |= GMT_BOT (-1);
else
get->mt_gstat |= GMT_EOF (-1);

View File

@ -497,10 +497,10 @@ inode_t::get_all_locks_list ()
wc[LOCK_OBJ_NAME_LEN] = L'\0';
short flags = wcstol (wc, &endptr, 16);
if ((flags & ~(F_FLOCK | F_POSIX)) != 0
|| (flags & (F_FLOCK | F_POSIX) == (F_FLOCK | F_POSIX)))
|| ((flags & (F_FLOCK | F_POSIX)) == (F_FLOCK | F_POSIX)))
continue;
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;
_off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
if (start < 0 || !endptr || *endptr != L'-')
@ -1442,7 +1442,7 @@ flock (int fd, int operation)
goto done;
}
res = cfd->lock (cmd, &fl);
if (res == -1 && (get_errno () == EAGAIN) || (get_errno () == EACCES))
if ((res == -1) && ((get_errno () == EAGAIN) || (get_errno () == EACCES)))
set_errno (EWOULDBLOCK);
done:
syscall_printf ("%d = flock (%d, %d)", res, fd, operation);

View File

@ -191,14 +191,12 @@ find_first_notloaded_dll (path_conv& pc)
PIMAGE_NT_HEADERS pExeNTHdr;
pExeNTHdr = PEHeaderFromHModule (hm);
if (!pExeNTHdr)
goto out;
if (pExeNTHdr)
{
DWORD importRVA;
importRVA = pExeNTHdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
if (!importRVA)
goto out;
if (importRVA)
{
long delta = rvadelta (pExeNTHdr, importRVA);
// Convert imports RVA to a usable pointer
@ -216,6 +214,8 @@ find_first_notloaded_dll (path_conv& pc)
res = strcpy (buf, lib);
}
}
}
}
out:
if (hm)

View File

@ -58,11 +58,11 @@
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
#ifdef REPLACE_GETOPT
int opterr = 1; /* if error message should be printed */
int optind = 1; /* index into parent argv vector */
int optopt = '?'; /* character checked for validity */
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
int __declspec(dllexport) opterr = 1; /* if error message should be printed */
int __declspec(dllexport) optind = 1; /* index into parent argv vector */
int __declspec(dllexport) optopt = '?';/* index into parent argv vector *//* character checked for validity */
int __declspec(dllexport) optreset; /* reset getopt */
char __declspec(dllexport) *optarg; /* argument associated with option */
#endif
#define PRINT_ERROR ((opterr) && (*options != ':'))

View File

@ -325,7 +325,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
*srch++ = 0;
if (numAddresses < DIM(statp->nsaddr_list)) {
DPRINTF(debug, "server \"%s\"\n", ap);
statp->nsaddr_list[numAddresses].sin_addr.s_addr = cygwin_inet_addr(ap);
statp->nsaddr_list[numAddresses].sin_addr.s_addr = cygwin_inet_addr((char *) ap);
if ( statp->nsaddr_list[numAddresses].sin_addr.s_addr != 0 )
numAddresses++;
}
@ -335,7 +335,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
statp->nscount = numAddresses;
}
else /* Parse the search line */
minires_get_search(list, statp);
minires_get_search((char *) list, statp);
}
return;
}

View File

@ -1130,7 +1130,7 @@ msync (void *addr, size_t len, int flags)
if (((uintptr_t) addr % getpagesize ())
|| (flags & ~(MS_ASYNC | MS_SYNC | MS_INVALIDATE))
|| (flags & (MS_ASYNC | MS_SYNC) == (MS_ASYNC | MS_SYNC)))
|| ((flags & (MS_ASYNC | MS_SYNC)) == (MS_ASYNC | MS_SYNC)))
{
set_errno (EINVAL);
goto out;

View File

@ -104,7 +104,7 @@ struct symlink_info
muto NO_COPY cwdstuff::cwd_lock;
static const GUID GUID_shortcut
= { 0x00021401L, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46 };
= { 0x00021401L, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
enum {
WSH_FLAG_IDLIST = 0x01, /* Contains an ITEMIDLIST. */
@ -2775,6 +2775,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
switch (what)
{
case CCP_POSIX_TO_WIN_A:
{
p.check ((const char *) from,
PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN
| (relative ? PC_NOFULL : 0));
@ -2791,6 +2792,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
*(buf += 2) = '\\';
}
lsiz = strlen (buf) + 1;
}
break;
case CCP_POSIX_TO_WIN_W:
p.check ((const char *) from,

View File

@ -116,10 +116,9 @@ pipesync::pipesync (HANDLE f, DWORD is_reader):
{
ev = CreateEvent (&sec_none_nih, true, false, NULL);
if (!ev)
{
system_printf ("couldn't create synchronization event for non-cygwin pipe, %E");
goto out;
}
else
{
debug_printf ("created thread synchronization event %p", ev);
non_cygwin_h = f;
reader = !!is_reader;
@ -140,6 +139,7 @@ pipesync::pipesync (HANDLE f, DWORD is_reader):
system_printf ("WFSO failed waiting for synchronization event for non-cygwin pipe, %E");
break;
}
}
out:
if (ev)

View File

@ -280,7 +280,7 @@ srandom(unsigned x)
/* Avoid a compiler warning when we really want to get at the junk in
an uninitialized variable. */
static unsigned long
dummy (unsigned long *x)
dummy (unsigned volatile long *x)
{
return *x;
}

View File

@ -238,23 +238,29 @@ getace (__aclent32_t &acl, int type, int id, DWORD win_ace_mask,
acl.a_id = id;
if ((win_ace_mask & FILE_READ_BITS) && !(acl.a_perm & (S_IROTH | DENY_R)))
{
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
acl.a_perm |= S_IROTH;
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
acl.a_perm |= DENY_R;
}
if ((win_ace_mask & FILE_WRITE_BITS) && !(acl.a_perm & (S_IWOTH | DENY_W)))
{
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
acl.a_perm |= S_IWOTH;
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
acl.a_perm |= DENY_W;
}
if ((win_ace_mask & FILE_EXEC_BITS) && !(acl.a_perm & (S_IXOTH | DENY_X)))
{
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
acl.a_perm |= S_IXOTH;
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
acl.a_perm |= DENY_X;
}
}
int
getacl (HANDLE handle, path_conv &pc, int nentries, __aclent32_t *aclbufp)

View File

@ -798,8 +798,9 @@ create_token (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
{
/* Switching user context to SYSTEM doesn't inherit the authentication
id of the user account running current process. */
if (usersid != well_known_system_sid)
if (!GetTokenInformation (hProcToken, TokenStatistics,
if (usersid == well_known_system_sid)
/* nothing to do */;
else if (!GetTokenInformation (hProcToken, TokenStatistics,
&stats, sizeof stats, &size))
debug_printf
("GetTokenInformation(hProcToken, TokenStatistics), %E");
@ -1103,8 +1104,10 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
authinf->checksum = CYGWIN_VERSION_MAGIC (CYGWIN_VERSION_DLL_MAJOR,
CYGWIN_VERSION_DLL_MINOR);
PDWORD csp = (PDWORD) &authinf->username;
PDWORD csp_end = (PDWORD) ((PBYTE) authinf + authinf_size);
PDWORD csp;
PDWORD csp_end;
csp = (PDWORD) &authinf->username;
csp_end = (PDWORD) ((PBYTE) authinf + authinf_size);
while (csp < csp_end)
authinf->checksum += *csp++;

View File

@ -506,7 +506,7 @@ out:
fh->get_name ());
else
{
#if 1
#if 0
/* FIXME: This code is not quite correct. There's no better solution
so far but to make simple assumptions based on WriteQuotaAvailable. */
@ -531,7 +531,7 @@ out:
that. This means that a pipe could still block since you could
be trying to write more to the pipe than is available in the
buffer but that is the hazard of select(). */
else if (fpli.WriteQuotaAvailable = (fpli.OutboundQuota - fpli.ReadDataAvailable))
else if ((fpli.WriteQuotaAvailable = (fpli.OutboundQuota - fpli.ReadDataAvailable)))
{
select_printf ("%s, ready for write: size %lu, avail %lu",
fh->get_name (),

View File

@ -974,7 +974,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
{
const char *p;
bool exeext = ascii_strcasematch (ext, ".exe");
if (exeext && real_path.iscygexec () || ascii_strcasematch (ext, ".bat"))
if ((exeext && real_path.iscygexec ()) || ascii_strcasematch (ext, ".bat"))
return 0;
if (!*ext && ((p = ext - 4) > real_path.get_win32 ())
&& (ascii_strcasematch (p, ".bat") || ascii_strcasematch (p, ".cmd")

View File

@ -3517,14 +3517,13 @@ popen (const char *command, const char *in_type)
fcntl64 (stdwhat, F_SETFD, state);
}
if (pid < 0)
goto err;
if (pid >= 0)
{
close (other_fd);
fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd];
fh->set_popen_pid (pid);
return fp;
}
err:
int save_errno = get_errno ();

View File

@ -81,8 +81,9 @@ tty::init_session ()
if (NOTSTATE (myself, PID_USETTY))
return;
if (myself->ctty == -1)
if (NOTSTATE (myself, PID_CYGPARENT))
if (myself->ctty != -1)
/* nothing to do */;
else if (NOTSTATE (myself, PID_CYGPARENT))
myself->ctty = cygwin_shared->tty.attach (myself->ctty);
else
return;

View File

@ -577,8 +577,7 @@ pwdgrp::load (const wchar_t *rel_path)
goto out;
}
buf[fsi.EndOfFile.LowPart] = '\0';
char *eptr = buf;
while ((eptr = add_line (eptr)))
for (char *eptr = buf; (eptr = add_line (eptr)); )
continue;
debug_printf ("%W curr_lines %d", rel_path, curr_lines);
res = succeeded;