else
return strcpy (buf, name ());
}
-
+
const char *cygheap_user::test_uid (char *&, const char *, size_t)
__attribute__ ((regparm (3)));
};
muto *cwd_lock;
char *get (char *, int = 1, int = 0, unsigned = CYG_MAX_PATH);
DWORD get_hash ();
- DWORD get_drive (char * dst)
+ DWORD get_drive (char * dst)
{
- get_initial ();
- memcpy (dst, win32, drive_length);
+ get_initial ();
+ memcpy (dst, win32, drive_length);
cwd_lock->release ();
return drive_length;
}
if (!inuse)
goto force_notterminated;
-
+
(void) TerminateThread (h, 0);
(void) WaitForSingleObject (h, INFINITE);
CloseHandle (h);
#endif
release (true);
}
-
+
goto out;
force_notterminated:
beyond EOF, zero filling or making
file sparse if so. */
unsigned query_open : 2; /* open file without requesting either
- read or write access */
+ read or write access */
unsigned close_on_exec : 1; /* close-on-exec */
unsigned need_fork_fixup : 1; /* Set if need to fixup after fork. */
unsigned has_changed : 1; /* Flag used to set ctime on close. */
eom_detected (0), eof_detected (0), lastblk_to_read (0)
{}
} status;
-
+
IMPLEMENT_STATUS_FLAG (bool, eom_detected)
IMPLEMENT_STATUS_FLAG (bool, eof_detected)
IMPLEMENT_STATUS_FLAG (bool, lastblk_to_read)
{
case PROCESS_FD:
{
- size_t fs;
+ size_t fs;
char *fdp = strrchr (path, '/');
if (!fdp || *++fdp == 'f') /* The "fd" directory itself. */
{
{
if (filebuf)
free (filebuf);
- size_t fs;
+ size_t fs;
switch (fileid)
{
case PROCESS_ROOT:
st.st_ino);
while (written < 62)
destbuf[len + written++] = ' ';
- len += written;
+ len += written;
len += __small_sprintf (destbuf + len, "%s\n", posix_modname);
}
out:
$rest = "$fh, $rest" if $rest =~ /^"/o;
$rest = fixup($rest, $vars);
if ($rest =~ /^(.*), ([a-z_]*_dev)/) {
- $pointers{$2} ||= "const device *$2 = $storage_loc;\n";
+ $pointers{$2} ||= "const device *$2 = $storage_loc;\n";
$rest = $1;
}
push(@storage, " {\"$dev\", " . $rest . "},\n");
if (!s/;.*$//o) {
if (!$struct && /^\s*(?:struct|class)\s*([a-z_0-9]+)/o) {
$def .= $_;
- $struct = $1
+ $struct = $1
}
next;
}
/* Get a Win32 priority matching the incoming nice factor. The incoming
nice is limited to the interval [-NZERO,NZERO-1]. */
-DWORD
+DWORD
nice_to_winprio (int &nice)
{
static const DWORD priority[] NO_COPY =
{
error = ENOTDIR;
goto out;
- }
+ }
if (pcheck_case == PCHECK_RELAXED)
goto out; // file found
/* Avoid further symlink evaluation. Only case checks are
for (int i = 0; i < 2; i++)
{
if (i)
- cygheap->user.deimpersonate ();
+ cygheap->user.deimpersonate ();
reg_key r (i, KEY_READ, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL);
if (i)
cygheap->user.reimpersonate ();
if (i == 0)
cygdrive_flags &= ~MOUNT_SYSTEM;
else
- cygdrive_flags |= MOUNT_SYSTEM;
+ cygdrive_flags |= MOUNT_SYSTEM;
slashify (cygdrive, cygdrive, 1);
cygdrive_len = strlen (cygdrive);
}
void set_normalized_path (const char *, bool) __attribute__ ((regparm (3)));
DWORD get_symlink_length () { return symlink_length; };
private:
- DWORD symlink_length;
+ DWORD symlink_length;
char path[CYG_MAX_PATH];
};
}
int exitcode = self->exitcode;
release ();
-
+
_my_tls.stacklock = 0;
_my_tls.stackptr = _my_tls.stack;
sigproc_printf ("Calling ExitProcess hProcess %p, n %p, exitcode %p",
/* Opens a key under the appropriate Cygwin key.
Do not use HKCU per MS KB 199190 */
-
+
reg_key::reg_key (bool isHKLM, REGSAM access, ...)
{
va_list av;
top = HKEY_LOCAL_MACHINE;
else
{
- char name[128];
- const char *names[2] = {cygheap->user.get_windows_id (name), ".DEFAULT"};
+ char name[128];
+ const char *names[2] = {cygheap->user.get_windows_id (name), ".DEFAULT"};
for (int i = 0; i < 2; i++)
{
key_is_invalid = RegOpenKeyEx (HKEY_USERS, names[i], 0, access, &top);
return;
}
OK:
- new (this) reg_key (top, access, "SOFTWARE",
+ new (this) reg_key (top, access, "SOFTWARE",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL);
if (top != HKEY_LOCAL_MACHINE)
RegCloseKey (top);
if (key_is_invalid)
return;
-
+
top = key;
va_start (av, access);
build_reg (top, access, av);
if (!name || !path)
return NULL;
__small_sprintf (key, "SOFTWARE\\Microsoft\\Windows%s\\CurrentVersion\\ProfileList\\",
- wincap.is_winnt ()?" NT":"");
+ wincap.is_winnt ()?" NT":"");
strcat (key, name);
if (!RegOpenKeyExA (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkey))
{
if (wincap.is_winnt ())
strcat (path, "\\NTUSER.DAT");
else
- strcat (path, "\\USER.DAT");
+ strcat (path, "\\USER.DAT");
if ((ret = RegLoadKeyA (HKEY_USERS, name, path)) != ERROR_SUCCESS)
debug_printf ("Loading user registry hive for %s failed: %d", name, ret);
}
/* Various types of security attributes for use in Create* functions. */
extern SECURITY_ATTRIBUTES sec_none, sec_none_nih, sec_all, sec_all_nih;
-extern SECURITY_ATTRIBUTES *__stdcall __sec_user (PVOID sa_buf, PSID sid1, PSID sid2,
+extern SECURITY_ATTRIBUTES *__stdcall __sec_user (PVOID sa_buf, PSID sid1, PSID sid2,
DWORD access2, BOOL inherit)
__attribute__ ((regparm (3)));
-extern bool sec_acl (PACL acl, bool original, bool admins, PSID sid1 = NO_SID,
+extern bool sec_acl (PACL acl, bool original, bool admins, PSID sid1 = NO_SID,
PSID sid2 = NO_SID, DWORD access2 = 0);
int __stdcall NTReadEA (const char *file, const char *attrname, char *buf, int len);
if (_my_tls.locals.exitsock != INVALID_SOCKET)
si->exitsock = _my_tls.locals.exitsock;
- else
+ else
{
si->exitsock = _my_tls.locals.exitsock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (_my_tls.locals.exitsock == INVALID_SOCKET)
};
extern shared_info *cygwin_shared;
-extern user_info *user_shared;
+extern user_info *user_shared;
#define mount_table (&(user_shared->mountinfo))
extern HANDLE cygwin_user_h;
#endif
char *__stdcall shared_name (char *, const char *, int);
-void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size,
+void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size,
shared_locations, PSECURITY_ATTRIBUTES psa = &sec_all);
extern void user_shared_initialize (bool reinit);
}
/* Check status of child process vs. waitq member.
-
+
parent_w is the pointer to the parent of the waitq member in question.
child is the subprocess being considered.
-
+
Returns non-zero if waiting thread released. */
static bool __stdcall
stopped_or_terminated (waitq *parent_w, _pinfo *child)
have open handles on a file and one of them calls unlink, then it
happens that the file is remove from the remote share even though the
other process still has an open handle. This other process than gets
- Win32 error 59, ERROR_UNEXP_NET_ERR when trying to access the file.
+ Win32 error 59, ERROR_UNEXP_NET_ERR when trying to access the file.
For some reason, that does not happen when using DeleteFile, which
- nicely succeeds but still, the file is available for the other process.
+ nicely succeeds but still, the file is available for the other process.
To reproduce, mount /tmp on a remote share and call
-
+
bash -c "cat << EOF"
Microsoft KB 837665 describes this problem as a bug in 2K3, but I have
existing file or directory real_new. Otherwise we end up with a
non-moved directory *and* a deleted read_new path. Also this case
has to generate an EINVAL in all circumstances,
-
+
NB: We could test this also before calling MoveFile but the idea is
that this is a somewhat seldom case and we like to avoid expensive
string comparison. So we allow MoveFile to fail and test the error
- code instead.
-
+ code instead.
+
The order in the condition is (hopefully) trimmed for doing the least
expensive stuff first. Nevertheless it would be nice if 9x could
generate the same error codes as NT.
Thou shalt use CYG_MAX_PATH throughout. It avoids the NUL vs no-NUL
issue and is neither of the Unixy ones [so we can punt on which
- one is the right one to use].
-
+ one is the right one to use].
+
Windows ANSI calls are limited to MAX_PATH in length. Cygwin calls that
thunk through to Windows Wide calls are limited to 32K. We define
CYG_MAX_PATH as a convenient, not to short, not too long 'happy medium'.
-
+
*/
#define CYG_MAX_PATH (MAX_PATH)