Message ID | 20221020182603.815-20-luoyonggang@gmail.com |
---|---|
State | Superseded |
Headers |
Return-Path: <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC8CF3839DF9 for <patchwork@sourceware.org>; Thu, 20 Oct 2022 18:27:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC8CF3839DF9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290453; bh=pV5k9XjtNM91HPNi81oJ1S+WElUoK9vHeUZhFdZgpn4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=YY+qEszUjKfmQlRVF9Yi7jCgJrdmicN6Jb2DQObSVvvm+ccne574BNuP3g1QrMfOg gopJTHSg+xOCD8727TCLznPBWUZlUP+KiNBld25niFPfvhwFF4bo3pk8cL36kw9MrD CwjgWAjksXLfWnaGC4SwIL/oUKESrkxDRbQ3PjU4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id AE59D384D159 for <elfutils-devel@sourceware.org>; Thu, 20 Oct 2022 18:27:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE59D384D159 Received: by mail-pf1-x432.google.com with SMTP id i3so314457pfc.11 for <elfutils-devel@sourceware.org>; Thu, 20 Oct 2022 11:27:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pV5k9XjtNM91HPNi81oJ1S+WElUoK9vHeUZhFdZgpn4=; b=A15g3syDXi4YMX0b2hf+QPMZ6+SJU50bin8iacaEVFRJE0qIkuA65N6VuarXHzTxxz pn5KrsIUYsHtMSz6PCWoY2q3uSZ3kBZe9s0k7QJsKqohVsMhFJDj2uW1RdZPobyUTkZQ JgjPs9KozMVR0mxVt8isLUVlzpq9935niaj70ZWf7lymVyracieFfrYqffAJSYSJPYY4 NBZ3IEsIPfy8OfGFmeLhH4O6w+hrgCmnZt4l8/V5h3t+f26Yj+r62VK+Ptls4sPjmvLt aW20jO05EArK/1fn4aupw6dclrO5Hsjk1lg3MbI9Kw5l3OFKB/ZBuYqFGJ/Ada7feQyb H22w== X-Gm-Message-State: ACrzQf0eReTJlF/4tJYQXSNPgEdA24xPC7x54Muh1AQPuTQybvQi+hP+ WWPWBjL+ZpInIlAfHY0qtZBzxptq1K4zPg== X-Google-Smtp-Source: AMsMyM4JZwtLiC2iOfG+zfj+RxT5fVqZAuU7xp1TlRNR03aA7YQv1/bTeAj70HleeGBv/wFEZtqnEQ== X-Received: by 2002:a65:6d89:0:b0:421:94bc:cb89 with SMTP id bc9-20020a656d89000000b0042194bccb89mr12770264pgb.129.1666290423979; Thu, 20 Oct 2022 11:27:03 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:03 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 19/25] libelf: F_GETFD may not predefined with msvc/mingw, guard the usage of it Date: Fri, 21 Oct 2022 02:25:58 +0800 Message-Id: <20221020182603.815-20-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> From: Yonggang Luo via Elfutils-devel <elfutils-devel@sourceware.org> Reply-To: Yonggang Luo <luoyonggang@gmail.com> Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Patches for building with mingw/gcc msvc/clang-cl
|
|
Commit Message
Yonggang Luo
Oct. 20, 2022, 6:25 p.m. UTC
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
libelf/elf_begin.c | 2 ++
1 file changed, 2 insertions(+)
Comments
Hi, On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel wrote: > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> > --- > libelf/elf_begin.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c > index 6d31882e..d867cd6f 100644 > --- a/libelf/elf_begin.c > +++ b/libelf/elf_begin.c > @@ -1163,12 +1163,14 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref) > if (ref != NULL) > /* Make sure the descriptor is not suddenly going away. */ > rwlock_rdlock (ref->lock); > +#if defined(F_GETFD) > else if (unlikely (fcntl (fildes, F_GETFD) == -1 && errno == > EBADF)) > { > /* We cannot do anything productive without a file > descriptor. */ > __libelf_seterrno (ELF_E_INVALID_FILE); > return NULL; > } > +#endif If you cannot check validity of fildes using fcntl, then shouldn't you at least check for fildes >= 0 ? Cheers, Mark
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 6d31882e..d867cd6f 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -1163,12 +1163,14 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref) if (ref != NULL) /* Make sure the descriptor is not suddenly going away. */ rwlock_rdlock (ref->lock); +#if defined(F_GETFD) else if (unlikely (fcntl (fildes, F_GETFD) == -1 && errno == EBADF)) { /* We cannot do anything productive without a file descriptor. */ __libelf_seterrno (ELF_E_INVALID_FILE); return NULL; } +#endif switch (cmd) {