Linux-Modules Archive on lore.kernel.org
 help / color / Atom feed
From: Topi Miettinen <toiwoton@gmail.com>
To: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: linux-modules <linux-modules@vger.kernel.org>
Subject: Re: [PATCH] libkmod-module: convert return value from system() to errno
Date: Tue, 24 Dec 2019 11:54:58 +0200
Message-ID: <8b27685f-138f-2a5e-3247-2ed2a855b7db@gmail.com> (raw)
In-Reply-To: <CAKi4VAK3pGJt8qA6CVrkwJOa5JLGtc63hWM0UZngp_qJb40jcw@mail.gmail.com>

On 24.12.2019 4.54, Lucas De Marchi wrote:
> On Mon, Dec 23, 2019 at 9:07 AM Topi Miettinen <toiwoton@gmail.com> wrote:
>>
>> Don't use exit status of a command directly as errno code, callers
>> will be confused.
>>
>> Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
>> ---
>>    libkmod/libkmod-module.c | 8 +++++---
>>    1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
>> index 8044a8f..6031d80 100644
>> --- a/libkmod/libkmod-module.c
>> +++ b/libkmod/libkmod-module.c
>> @@ -983,11 +983,13 @@ static int command_do(struct kmod_module *mod,
>> const char *type,
>>           if (err == -1 || WEXITSTATUS(err)) {
>>                   ERR(mod->ctx, "Error running %s command for %s\n",
>>                                                                   type,
>> modname);
>> -               if (err != -1)
>> -                       err = -WEXITSTATUS(err);
> 
> I don't think we actually care about differentiating them. So just a plain
> return -EINVAL;  here would suffice, makes sense?

I think it would lose potentially valuable information. For example 
EPERM could tell the system administrator of a problem with MAC 
configuration preventing execution of the shell, ENOENT could show that 
the shell or shared libraries are missing and so forth.

-Topi

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 17:06 Topi Miettinen
2019-12-24  2:54 ` Lucas De Marchi
2019-12-24  9:54   ` Topi Miettinen [this message]
2019-12-28 22:59     ` Lucas De Marchi
2019-12-29 11:04       ` Topi Miettinen

Reply instructions:

You may reply publically 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=8b27685f-138f-2a5e-3247-2ed2a855b7db@gmail.com \
    --to=toiwoton@gmail.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    /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

Linux-Modules Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-modules/0 linux-modules/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-modules linux-modules/ https://lore.kernel.org/linux-modules \
		linux-modules@vger.kernel.org
	public-inbox-index linux-modules

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-modules


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git