All of lore.kernel.org
 help / color / mirror / Atom feed
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
To: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/nfs-utils: fix time_t on 64-bits platforms build
Date: Sun, 25 Jul 2021 19:40:23 +0200	[thread overview]
Message-ID: <6228377B-52F6-4957-8373-7A87E1C712CD@benettiengineering.com> (raw)
In-Reply-To: <dd7ac7f1-924b-7e12-d55f-f217853cb041@benettiengineering.com>

Please drop this patch since I’m going another upstream patch.

Thank you
Giulio Benetti

> Il giorno 22 lug 2021, alle ore 17:41, Giulio Benetti <giulio.benetti@benettiengineering.com> ha scritto:
> 
> On 7/22/21 5:32 PM, Giulio Benetti wrote:
>> Add patch to fix time_t build failure on 64-bits platforms.
> 
> Forgot to add:
> ```
> Patch is pending upstream:
> https://patchwork.kernel.org/project/linux-nfs/patch/20210722152411.1156295-1-giulio.benetti@benettiengineering.com/
> ```
>> Fixes:
>> http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>>  ...me_t-build-error-on-64-bits-platform.patch | 52 +++++++++++++++++++
>>  1 file changed, 52 insertions(+)
>>  create mode 100644 package/nfs-utils/0001-nfs-utils-fix-time_t-build-error-on-64-bits-platform.patch
>> diff --git a/package/nfs-utils/0001-nfs-utils-fix-time_t-build-error-on-64-bits-platform.patch b/package/nfs-utils/0001-nfs-utils-fix-time_t-build-error-on-64-bits-platform.patch
>> new file mode 100644
>> index 0000000000..1dec494f26
>> --- /dev/null
>> +++ b/package/nfs-utils/0001-nfs-utils-fix-time_t-build-error-on-64-bits-platform.patch
>> @@ -0,0 +1,52 @@
>> +From 9d25faae1216258b617dd2db134bc1d9fa0fd73d Mon Sep 17 00:00:00 2001
>> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> +Date: Thu, 22 Jul 2021 16:13:14 +0200
>> +Subject: [PATCH] nfs-utils: fix time_t build error on 64-bits platforms
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +When passing time_t type to "%ld" on 64-bits platforms where time_t is a
>> +'long long' we encouter this build failure:
>> +error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
>> +
>> +So let's change "%ld" markers to "%lld" assuming it to be a 64-bits and
>> +cast variables to '(long long)' if the type is a time_t.
>> +
>> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> +---
>> + utils/nfsdcltrack/nfsdcltrack.c | 2 +-
>> + utils/nfsdcltrack/sqlite.c      | 4 ++--
>> + 2 files changed, 3 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
>> +index e926f1c0..437477bb 100644
>> +--- a/utils/nfsdcltrack/nfsdcltrack.c
>> ++++ b/utils/nfsdcltrack/nfsdcltrack.c
>> +@@ -525,7 +525,7 @@ cltrack_gracedone(const char *timestr)
>> +    if (*tail)
>> +        return -EINVAL;
>> +
>> +-    xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
>> ++    xlog(D_GENERAL, "%s: grace done. gracetime=%lld", __func__, (long long)gracetime);
>> +
>> +    ret = sqlite_remove_unreclaimed(gracetime);
>> +
>> +diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
>> +index f79aebb3..6e603087 100644
>> +--- a/utils/nfsdcltrack/sqlite.c
>> ++++ b/utils/nfsdcltrack/sqlite.c
>> +@@ -544,8 +544,8 @@ sqlite_remove_unreclaimed(time_t grace_start)
>> +    int ret;
>> +    char *err = NULL;
>> +
>> +-    ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
>> +-            grace_start);
>> ++    ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %lld",
>> ++            (long long)grace_start);
>> +    if (ret < 0) {
>> +        return ret;
>> +    } else if ((size_t)ret >= sizeof(buf)) {
>> +--
>> +2.25.1
>> +
> 
> -- 
> Giulio Benetti
> Benetti Engineering sas

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

  reply	other threads:[~2021-07-25 17:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 15:32 [Buildroot] [PATCH] package/nfs-utils: fix time_t on 64-bits platforms build Giulio Benetti
2021-07-22 15:33 ` Giulio Benetti
2021-07-25 17:40   ` Giulio Benetti [this message]
2021-07-25 19:38     ` Petr Vorel
2021-07-25 19:55       ` Giulio Benetti
2021-07-25 20:02         ` Petr Vorel

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=6228377B-52F6-4957-8373-7A87E1C712CD@benettiengineering.com \
    --to=giulio.benetti@benettiengineering.com \
    --cc=buildroot@buildroot.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 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.