* cygheap.cc (cygheap_user::~cygheap_user): Remove unneeded if 0'ed code.

* fhandler_registry.cc (fhandler_registry::exists): Recode goto as if/else to
avoid a gcc4 compiler warning.
(fhandler_registry::open): Ditto.  Use one goto rather than two.
* gentls_offsets: Fix compiler warning in generated output.
* tlsoffsets.h: Regenerate.
* mount.cc (fillout_mntent): slashify native paths returned via getmntent.
This commit is contained in:
Christopher Faylor 2008-12-13 21:05:31 +00:00
parent a1631dba6c
commit 9fe25af7a6
6 changed files with 160 additions and 155 deletions

View File

@ -1,3 +1,18 @@
2008-12-13 Christopher Faylor <me+cygwin@cgf.cx>
* cygheap.cc (cygheap_user::~cygheap_user): Remove unneeded if 0'ed
code.
* fhandler_registry.cc (fhandler_registry::exists): Recode goto as
if/else to avoid a gcc4 compiler warning.
(fhandler_registry::open): Ditto. Use one goto rather than two.
* gentls_offsets: Fix compiler warning in generated output.
* tlsoffsets.h: Regenerate.
* mount.cc (fillout_mntent): slashify native paths returned via
getmntent.
2008-12-08 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* resolv.h: #include <netinet/in.h> for sockaddr_in typedef.

View File

@ -424,16 +424,6 @@ cygheap_root::set (const char *posix, const char *native, bool caseinsensitive)
cygheap_user::~cygheap_user ()
{
#if 0
if (pname)
cfree (pname);
if (plogsrv)
cfree (plogsrv - 2);
if (pdomain)
cfree (pdomain);
if (psid)
cfree (psid);
#endif
}
void

View File

@ -147,7 +147,7 @@ decode_regname (char * dst, const char * src, int len = -1)
char *p;
c = strtoul (s, &p, 16);
if (!(must_encode (c) ||
(c == '.' && si == 0 && (len == 3 || (src[3] == '.' && len == 4)))))
(c == '.' && si == 0 && (len == 3 || (src[3] == '.' && len == 4)))))
return -1;
dst[di++] = c;
si += 2;
@ -237,72 +237,72 @@ fhandler_registry::exists ()
file++;
if (file == path)
{
for (int i = 0; registry_listing[i]; i++)
if (path_prefix_p (registry_listing[i], path,
strlen (registry_listing[i]), true))
{
file_type = 1;
goto out;
}
goto out;
}
char dec_file[NAME_MAX + 1];
int val_only = decode_regname (dec_file, file);
if (val_only < 0)
goto out;
if (!val_only)
hKey = open_key (path, KEY_READ, wow64, false);
if (hKey != (HKEY) INVALID_HANDLE_VALUE)
file_type = 1;
for (int i = 0; registry_listing[i]; i++)
if (path_prefix_p (registry_listing[i], path,
strlen (registry_listing[i]), true))
{
file_type = 1;
break;
}
else
{
hKey = open_key (path, KEY_READ, wow64, true);
if (hKey == (HKEY) INVALID_HANDLE_VALUE)
return 0;
char dec_file[NAME_MAX + 1];
int val_only = decode_regname (dec_file, file);
if (val_only < 0)
goto out;
if (!val_only)
hKey = open_key (path, KEY_READ, wow64, false);
if (hKey != (HKEY) INVALID_HANDLE_VALUE)
file_type = 1;
else
{
while (ERROR_SUCCESS ==
(error = RegEnumKeyEx (hKey, index++, buf, &buf_size,
NULL, NULL, NULL, NULL))
|| (error == ERROR_MORE_DATA))
hKey = open_key (path, KEY_READ, wow64, true);
if (hKey == (HKEY) INVALID_HANDLE_VALUE)
return 0;
if (!val_only)
{
if (strcasematch (buf, dec_file))
while (ERROR_SUCCESS ==
(error = RegEnumKeyEx (hKey, index++, buf, &buf_size,
NULL, NULL, NULL, NULL))
|| (error == ERROR_MORE_DATA))
{
file_type = 1;
if (strcasematch (buf, dec_file))
{
file_type = 1;
goto out;
}
buf_size = NAME_MAX + 1;
}
if (error != ERROR_NO_MORE_ITEMS)
{
seterrno_from_win_error (__FILE__, __LINE__, error);
goto out;
}
buf_size = NAME_MAX + 1;
index = 0;
buf_size = NAME_MAX + 1;
}
while (ERROR_SUCCESS ==
(error = RegEnumValue (hKey, index++, buf, &buf_size, NULL, NULL,
NULL, NULL))
|| (error == ERROR_MORE_DATA))
{
if ( (buf[0] == '\0' && strcasematch (file, DEFAULT_VALUE_NAME))
|| strcasematch (buf, dec_file))
{
file_type = -1;
goto out;
}
buf_size = NAME_MAX + 1;
}
if (error != ERROR_NO_MORE_ITEMS)
{
seterrno_from_win_error (__FILE__, __LINE__, error);
goto out;
}
index = 0;
buf_size = NAME_MAX + 1;
}
while (ERROR_SUCCESS ==
(error = RegEnumValue (hKey, index++, buf, &buf_size, NULL, NULL,
NULL, NULL))
|| (error == ERROR_MORE_DATA))
{
if ( (buf[0] == '\0' && strcasematch (file, DEFAULT_VALUE_NAME))
|| strcasematch (buf, dec_file))
{
file_type = -1;
goto out;
}
buf_size = NAME_MAX + 1;
}
if (error != ERROR_NO_MORE_ITEMS)
{
seterrno_from_win_error (__FILE__, __LINE__, error);
goto out;
}
}
out:
@ -649,64 +649,64 @@ fhandler_registry::open (int flags, mode_t mode)
{
set_errno (EROFS);
res = 0;
goto out;
}
else
{
set_errno (ENOENT);
res = 0;
goto out;
}
goto out;
}
if (flags & O_WRONLY)
{
set_errno (EROFS);
res = 0;
goto out;
}
char dec_file[NAME_MAX + 1];
int val_only = decode_regname (dec_file, file);
if (val_only < 0)
else
{
set_errno (EINVAL);
res = 0;
goto out;
}
if (!val_only)
handle = open_key (path, KEY_READ, wow64, false);
if (handle == (HKEY) INVALID_HANDLE_VALUE)
{
handle = open_key (path, KEY_READ, wow64, true);
if (handle == (HKEY) INVALID_HANDLE_VALUE)
char dec_file[NAME_MAX + 1];
int val_only = decode_regname (dec_file, file);
if (val_only < 0)
{
set_errno (EINVAL);
res = 0;
goto out;
}
}
else
flags |= O_DIROPEN;
set_io_handle (handle);
if (!val_only)
handle = open_key (path, KEY_READ, wow64, false);
if (handle == (HKEY) INVALID_HANDLE_VALUE)
{
handle = open_key (path, KEY_READ, wow64, true);
if (handle == (HKEY) INVALID_HANDLE_VALUE)
{
res = 0;
goto out;
}
}
else
flags |= O_DIROPEN;
if (strcasematch (dec_file, DEFAULT_VALUE_NAME))
value_name = cstrdup ("");
else
value_name = cstrdup (dec_file);
set_io_handle (handle);
if (!(flags & O_DIROPEN) && !fill_filebuf ())
{
RegCloseKey (handle);
res = 0;
goto out;
}
if (strcasematch (dec_file, DEFAULT_VALUE_NAME))
value_name = cstrdup ("");
else
value_name = cstrdup (dec_file);
if (flags & O_APPEND)
position = filesize;
else
position = 0;
if (!(flags & O_DIROPEN) && !fill_filebuf ())
{
RegCloseKey (handle);
res = 0;
goto out;
}
if (flags & O_APPEND)
position = filesize;
else
position = 0;
}
success:
res = 1;
@ -834,7 +834,7 @@ open_key (const char *name, REGSAM access, DWORD wow64, bool isValue)
name++;
int val_only = decode_regname (component, anchor, name - anchor);
if (val_only < 0)
{
{
set_errno (EINVAL);
if (parentOpened)
RegCloseKey (hParentKey);

View File

@ -56,7 +56,7 @@ main(int argc, char **argv)
{
$struct *foo;
# define foo_beg ((char *) foo)
# define offset(f) (-CYGTLS_PADSIZE + ((char *) &(foo->f)) - foo_beg)
# define offset(f) ((int) (((char *) &(foo->f)) - foo_beg) - CYGTLS_PADSIZE)
# define poffset(f) (((char *) &(foo->f)) - ((char *) foo))
EOF
print TMP 'puts ("//;# autogenerated: Do not edit.\n");', "\n\n";

View File

@ -1122,7 +1122,7 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
table because the mount table might change, causing weird effects
from the getmntent user's point of view. */
strcpy (_my_tls.locals.mnt_fsname, native_path);
slashify (native_path, _my_tls.locals.mnt_fsname, false);
ret.mnt_fsname = _my_tls.locals.mnt_fsname;
strcpy (_my_tls.locals.mnt_dir, posix_path);
ret.mnt_dir = _my_tls.locals.mnt_dir;
@ -1135,7 +1135,7 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
tmp_pathbuf tp;
UNICODE_STRING unat;
tp.u_get (&unat);
get_nt_native_path (native_path, unat);
get_nt_native_path (_my_tls.locals.mnt_fsname, unat);
if (append_bs)
RtlAppendUnicodeToString (&unat, L"\\");
mntinfo.update (&unat, NULL);

View File

@ -1,6 +1,6 @@
//;# autogenerated: Do not edit.
//; $tls::sizeof__cygtls = 4296;
//; $tls::sizeof__cygtls = 4320;
//; $tls::func = -12700;
//; $tls::pfunc = 0;
//; $tls::el = -12696;
@ -37,32 +37,32 @@
//; $tls::plocal_clib = 420;
//; $tls::__dontuse = -12280;
//; $tls::p__dontuse = 420;
//; $tls::locals = -11216;
//; $tls::plocals = 1484;
//; $tls::_ctinfo = -9508;
//; $tls::p_ctinfo = 3192;
//; $tls::andreas = -9504;
//; $tls::pandreas = 3196;
//; $tls::wq = -9488;
//; $tls::pwq = 3212;
//; $tls::prev = -9460;
//; $tls::pprev = 3240;
//; $tls::next = -9456;
//; $tls::pnext = 3244;
//; $tls::sig = -9452;
//; $tls::psig = 3248;
//; $tls::incyg = -9448;
//; $tls::pincyg = 3252;
//; $tls::spinning = -9444;
//; $tls::pspinning = 3256;
//; $tls::stacklock = -9440;
//; $tls::pstacklock = 3260;
//; $tls::stackptr = -9436;
//; $tls::pstackptr = 3264;
//; $tls::stack = -9432;
//; $tls::pstack = 3268;
//; $tls::initialized = -8408;
//; $tls::pinitialized = 4292;
//; $tls::locals = -11192;
//; $tls::plocals = 1508;
//; $tls::_ctinfo = -9484;
//; $tls::p_ctinfo = 3216;
//; $tls::andreas = -9480;
//; $tls::pandreas = 3220;
//; $tls::wq = -9464;
//; $tls::pwq = 3236;
//; $tls::prev = -9436;
//; $tls::pprev = 3264;
//; $tls::next = -9432;
//; $tls::pnext = 3268;
//; $tls::sig = -9428;
//; $tls::psig = 3272;
//; $tls::incyg = -9424;
//; $tls::pincyg = 3276;
//; $tls::spinning = -9420;
//; $tls::pspinning = 3280;
//; $tls::stacklock = -9416;
//; $tls::pstacklock = 3284;
//; $tls::stackptr = -9412;
//; $tls::pstackptr = 3288;
//; $tls::stack = -9408;
//; $tls::pstack = 3292;
//; $tls::initialized = -8384;
//; $tls::pinitialized = 4316;
//; __DATA__
#define tls_func (-12700)
@ -101,29 +101,29 @@
#define tls_plocal_clib (420)
#define tls___dontuse (-12280)
#define tls_p__dontuse (420)
#define tls_locals (-11216)
#define tls_plocals (1484)
#define tls__ctinfo (-9508)
#define tls_p_ctinfo (3192)
#define tls_andreas (-9504)
#define tls_pandreas (3196)
#define tls_wq (-9488)
#define tls_pwq (3212)
#define tls_prev (-9460)
#define tls_pprev (3240)
#define tls_next (-9456)
#define tls_pnext (3244)
#define tls_sig (-9452)
#define tls_psig (3248)
#define tls_incyg (-9448)
#define tls_pincyg (3252)
#define tls_spinning (-9444)
#define tls_pspinning (3256)
#define tls_stacklock (-9440)
#define tls_pstacklock (3260)
#define tls_stackptr (-9436)
#define tls_pstackptr (3264)
#define tls_stack (-9432)
#define tls_pstack (3268)
#define tls_initialized (-8408)
#define tls_pinitialized (4292)
#define tls_locals (-11192)
#define tls_plocals (1508)
#define tls__ctinfo (-9484)
#define tls_p_ctinfo (3216)
#define tls_andreas (-9480)
#define tls_pandreas (3220)
#define tls_wq (-9464)
#define tls_pwq (3236)
#define tls_prev (-9436)
#define tls_pprev (3264)
#define tls_next (-9432)
#define tls_pnext (3268)
#define tls_sig (-9428)
#define tls_psig (3272)
#define tls_incyg (-9424)
#define tls_pincyg (3276)
#define tls_spinning (-9420)
#define tls_pspinning (3280)
#define tls_stacklock (-9416)
#define tls_pstacklock (3284)
#define tls_stackptr (-9412)
#define tls_pstackptr (3288)
#define tls_stack (-9408)
#define tls_pstack (3292)
#define tls_initialized (-8384)
#define tls_pinitialized (4316)