* sec_acl.cc (getacl): Avoid compiler warning.

* security.cc (write_sd): Ditto.  Fix error handling.
This commit is contained in:
Corinna Vinschen 2004-04-14 20:16:29 +00:00
parent 0c5f00f98a
commit a653f600f5
3 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2004-04-14 Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (getacl): Avoid compiler warning.
* security.cc (write_sd): Ditto. Fix error handling.
2004-04-14 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (fstat64): Use get_namehash instead of hash_path_name.

View File

@ -261,12 +261,11 @@ getacl (HANDLE handle, const char *file, DWORD attr, int nentries,
{
security_descriptor sd;
int ret;
if (!handle || get_nt_object_security (handle, SE_FILE_OBJECT, sd)
&& (ret = read_sd (file, sd)) <= 0)
&& read_sd (file, sd) <= 0)
{
debug_printf ("read_sd %E");
return ret;
return -1;
}
cygpsid owner_sid;

View File

@ -1148,8 +1148,9 @@ write_sd (HANDLE fh, const char *file, security_descriptor &sd)
return -1;
}
}
NTSTATUS ret;
NTSTATUS ret = STATUS_SUCCESS;
int retry = 0;
res = -1;
for (; retry < 2; ++retry)
{
if (retry && (fh = CreateFile (file, WRITE_OWNER | WRITE_DAC,
@ -1168,12 +1169,13 @@ write_sd (HANDLE fh, const char *file, security_descriptor &sd)
}
if (retry && fh != INVALID_HANDLE_VALUE)
CloseHandle (fh);
if (ret != STATUS_SUCCESS)
{
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
return -1;
}
return 0;
if (fh == INVALID_HANDLE_VALUE) /* CreateFile failed */
__seterrno ();
else if (ret != STATUS_SUCCESS) /* NtSetSecurityObject failed */
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
else /* Everything's fine. */
res = 0;
return res;
}
static void