* 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> 2004-04-14 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (fstat64): Use get_namehash instead of hash_path_name. * 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; security_descriptor sd;
int ret;
if (!handle || get_nt_object_security (handle, SE_FILE_OBJECT, sd) 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"); debug_printf ("read_sd %E");
return ret; return -1;
} }
cygpsid owner_sid; cygpsid owner_sid;

View File

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