All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Giuliano Procida <gprocida@google.com>
Cc: dwarves@vger.kernel.org, kernel-team@android.com,
	maennich@google.com, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH 2/3] btf_encoder: Improve error-handling around objcopy
Date: Wed, 20 Jan 2021 23:09:45 -0800	[thread overview]
Message-ID: <CAEf4BzbPwkCGhLeHbpS+asrLGs_BqRrqxK_gz-Pfzkgk9tbaAw@mail.gmail.com> (raw)
In-Reply-To: <20210118160139.1971039-3-gprocida@google.com>

On Mon, Jan 18, 2021 at 8:01 AM Giuliano Procida <gprocida@google.com> wrote:
>
> * Report the correct filename when objcopy fails.
> * Unlink the temporary file on error.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>
> ---

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  libbtf.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libbtf.c b/libbtf.c
> index 3709087..7552d8e 100644
> --- a/libbtf.c
> +++ b/libbtf.c
> @@ -786,18 +786,19 @@ static int btf_elf__write(const char *filename, struct btf *btf)
>                 if (write(fd, raw_btf_data, raw_btf_size) != raw_btf_size) {
>                         fprintf(stderr, "%s: write of %d bytes to '%s' failed: %d!\n",
>                                 __func__, raw_btf_size, tmp_fn, errno);
> -                       goto out;
> +                       goto unlink;
>                 }
>
>                 snprintf(cmd, sizeof(cmd), "%s --add-section .BTF=%s %s",
>                          llvm_objcopy, tmp_fn, filename);
>                 if (system(cmd)) {
>                         fprintf(stderr, "%s: failed to add .BTF section to '%s': %d!\n",
> -                               __func__, tmp_fn, errno);
> -                       goto out;
> +                               __func__, filename, errno);
> +                       goto unlink;
>                 }
>
>                 err = 0;
> +       unlink:
>                 unlink(tmp_fn);
>         }
>
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>

  reply	other threads:[~2021-01-21  7:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 16:01 [PATCH 0/3] Small fixes and improvements Giuliano Procida
2021-01-18 16:01 ` [PATCH 1/3] btf_encoder: Fix handling of restrict qualifier Giuliano Procida
2021-01-21  7:07   ` Andrii Nakryiko
2021-01-21 13:04     ` Arnaldo Carvalho de Melo
2021-01-18 16:01 ` [PATCH 2/3] btf_encoder: Improve error-handling around objcopy Giuliano Procida
2021-01-21  7:09   ` Andrii Nakryiko [this message]
2021-01-18 16:01 ` [PATCH 3/3] btf_encoder: Set .BTF section alignment to 16 Giuliano Procida
2021-01-21  7:16   ` Andrii Nakryiko
     [not found]     ` <CAGvU0HmE+gs8eNQcXmFrEERHaiGEnMgqxBho4Ny3DLCe6WR55Q@mail.gmail.com>
2021-01-21 20:07       ` Andrii Nakryiko
2021-01-25 12:53         ` Giuliano Procida
2021-01-26  0:28           ` Andrii Nakryiko
2021-01-26 11:43             ` Giuliano Procida
2021-01-27 15:08         ` Giuliano Procida
2021-01-27 18:06           ` Giuliano Procida
2021-01-27 19:56             ` Andrii Nakryiko
2021-01-21 11:35 ` [PATCH dwarves v2 0/3] Small fixes and improvements Giuliano Procida
2021-01-21 11:35   ` [PATCH dwarves v2 1/3] btf_encoder: Fix handling of restrict qualifier Giuliano Procida
2021-01-21 13:21     ` Arnaldo Carvalho de Melo
2021-01-21 11:35   ` [PATCH dwarves v2 2/3] btf_encoder: Improve error-handling around objcopy Giuliano Procida
2021-01-21 13:24     ` Arnaldo Carvalho de Melo
2021-01-21 11:35   ` [PATCH dwarves v2 3/3] btf_encoder: Set .BTF section alignment to 16 Giuliano Procida
2021-01-21 13:23     ` Arnaldo Carvalho de Melo

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=CAEf4BzbPwkCGhLeHbpS+asrLGs_BqRrqxK_gz-Pfzkgk9tbaAw@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=gprocida@google.com \
    --cc=kernel-team@android.com \
    --cc=kernel-team@fb.com \
    --cc=maennich@google.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.