From 842c741f9821834c2a6220f0a704c30e214598b7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 2 Aug 2001 16:01:47 +0000 Subject: [PATCH] * security.cc (set_file_attribute): Clean up. Don't call `set_nt_attribute' when ntsec isn't set. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/security.cc | 20 +++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 36af78a0f..587c3679b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 2 17:59:00 2001 Corinna Vinschen + + * security.cc (set_file_attribute): Clean up. Don't call + `set_nt_attribute' when ntsec isn't set. + Sat Jul 28 22:30:55 2001 Christopher Faylor * dcrt0.cc (alloc_stack_hard_way): Make half-hearted attempt to deal diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index fbc6c8869..489c75bbf 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1587,18 +1587,16 @@ set_file_attribute (int use_ntsec, const char *file, if ((attribute & S_IFLNK) == S_IFLNK) attribute |= S_IRWXU | S_IRWXG | S_IRWXO; - if (allow_ntea && (!use_ntsec || !allow_ntsec)) - { - if (!NTWriteEA (file, ".UNIXATTR", (char *) &attribute, - sizeof (attribute))) - { - __seterrno (); - return -1; - } - return 0; - } + int ret = 0; - int ret = set_nt_attribute (file, uid, gid, logsrv, attribute); + if (use_ntsec && allow_ntsec) + ret = set_nt_attribute (file, uid, gid, logsrv, attribute); + else if (allow_ntea && !NTWriteEA (file, ".UNIXATTR", (char *) &attribute, + sizeof (attribute))) + { + __seterrno (); + ret = -1; + } syscall_printf ("%d = set_file_attribute (%s, %d, %d, %p)", ret, file, uid, gid, attribute); return ret;