public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: bzip2-devel@sourceware.org
Subject: [Bug bzip2/25492] bzip2.c: ignoring return value of ‘fchown’
Date: Sun, 17 May 2020 13:00:42 +0000	[thread overview]
Message-ID: <bug-25492-11876-A3l8EhXMOV@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25492-11876@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=25492

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |mark at klomp dot org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
I don't think this is a real bug. First we do "check" the result, by throwing
it away, that is what the (void) does. And my compiler doesn't show that
warning, even with -Wunused-result.

This is the whole function:

static  
void applySavedFileAttrToOutputFile ( IntNative fd )
{
#  if BZ_UNIX
   IntNative retVal;

   retVal = fchmod ( fd, fileMetaInfo.st_mode );
   ERROR_IF_NOT_ZERO ( retVal );

   (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
   /* chown() will in many cases return with EPERM, which can
      be safely ignored.
   */
#  endif
}

As you can see, the comment already explains why we don't care.

What the function tried to do is set the attributes of the new output file to
the same attributes of the input file. So if your input file was owned by user
mark, it will try to set the output file to the same owner. If you aren't the
user mark, but only had read permission to the input file, and you don't have
permission to change the owner of a file, then the output file will just be
owned by you.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2020-05-17 13:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-01  0:00 [Bug bzip2/25492] New: " noloader at gmail dot com
2020-05-17 13:00 ` mark at klomp dot org [this message]
2021-04-11 15:13 ` [Bug bzip2/25492] " vapier at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-25492-11876-A3l8EhXMOV@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=bzip2-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).