* security.cc (write_sd): Ditto. Fix error handling.
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.
2004-04-14 Corinna Vinschen <corinna@vinschen.de>
{
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;
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,
}
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