From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by sourceware.org (Postfix) with ESMTPS id DB4F73858CDB for ; Fri, 24 Mar 2023 00:48:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB4F73858CDB Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=archlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f49.google.com with SMTP id x3so1819620edb.10 for ; Thu, 23 Mar 2023 17:48:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679618929; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f4BEO4mS00N4zmA6l6q28zK8yri7m2VE6ZPAmgo5HYA=; b=kdjblJ+QrOicUS9PnQ93hiA7qsTcFNkXyn7BhBPWlhY7dqCEa6UAVia1pdssO2XeMs GgyFWSW7H39cFYlpuQqAcXO8+kEib6+MfrIzmkk0SWsHkCQeg4CnWC5evNl3YqBd6TsN dEpDFCJQ7ShEkKhnaxk5rXoI1BEjWTq0VXbUQGUSpxpu26e3OOnPi1JmyP1a517jBmSa CVGzDOlptf5lnwH7znCFLmXu+K0dYqhXU2aCgL7ne5OnSoaxT9HKSbXhcd+l1B0A+WJD YuiphMW6a11qxQHupUs59MHnsFDXbvHNxrxH5Cr6PXQ2PePkK8BImzwFFqmHJitJqUPk slDg== X-Gm-Message-State: AAQBX9f+e7YCbRYN3kwBGFEuKGi+bJgSOQanCNz6KmCPObHRty4MtzHc tMlq14JRkn2dnLuEvo8eKu7H5c/gdX8= X-Google-Smtp-Source: AKy350YeJgZcetTeyktboKY0JHsFmDzJDcHqVSVWlSAt+vobWKbOBt7SL7RWQrE4qS1YKsxhIj4vaA== X-Received: by 2002:aa7:c2d9:0:b0:4fa:315a:cb59 with SMTP id m25-20020aa7c2d9000000b004fa315acb59mr1315951edp.12.1679618929177; Thu, 23 Mar 2023 17:48:49 -0700 (PDT) Received: from ocellus.fritz.box (p200300eae71e29008ef8c5fffef034ee.dip0.t-ipconnect.de. [2003:ea:e71e:2900:8ef8:c5ff:fef0:34ee]) by smtp.gmail.com with ESMTPSA id u25-20020a50c2d9000000b004faf34064c8sm9824029edf.62.2023.03.23.17.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 17:48:48 -0700 (PDT) From: "Jan Alexander Steffens (heftig)" To: elfutils-devel@sourceware.org Cc: "Jan Alexander Steffens (heftig)" Subject: [PATCH 1/3] debuginfod: Replace futimes with futimens Date: Fri, 24 Mar 2023 01:48:03 +0100 Message-Id: <20230324004805.156080-1-heftig@archlinux.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Similar to what 8c4aa0ef998191ed828a37190dc179b91649938a did for ar and strip, replace the non-standard futimes with the POSIX futimens. Signed-off-by: Jan Alexander Steffens (heftig) --- debuginfod/debuginfod-client.c | 6 +++--- debuginfod/debuginfod.cxx | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index b33408eb..460afd5c 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1721,10 +1721,10 @@ debuginfod_query_server (debuginfod_client *c, if (curl_res != CURLE_OK) mtime = time(NULL); /* fall back to current time */ - struct timeval tvs[2]; + struct timespec tvs[2]; tvs[0].tv_sec = tvs[1].tv_sec = mtime; - tvs[0].tv_usec = tvs[1].tv_usec = 0; - (void) futimes (fd, tvs); /* best effort */ + tvs[0].tv_nsec = tvs[1].tv_nsec = 0; + (void) futimens (fd, tvs); /* best effort */ /* PR27571: make cache files casually unwriteable; dirs are already 0700 */ (void) fchmod(fd, 0400); diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 99b1f2b9..b39c0591 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -1635,13 +1635,12 @@ extract_section (int elf_fd, int64_t parent_mtime, throw libc_exception (errno, "cannot write to temporary file"); /* Set mtime to be the same as the parent file's mtime. */ - struct timeval tvs[2]; + struct timespec tvs[2]; if (fstat (elf_fd, &fs) != 0) throw libc_exception (errno, "cannot fstat file"); - tvs[0].tv_sec = tvs[1].tv_sec = fs.st_mtime; - tvs[0].tv_usec = tvs[1].tv_usec = 0; - (void) futimes (fd, tvs); + tvs[0] = tvs[1] = fs.st_mtim; + (void) futimens (fd, tvs); /* Add to fdcache. */ fdcache.intern (b_source, section, tmppath, data->d_size, true); @@ -1951,10 +1950,10 @@ handle_buildid_r_match (bool internal_req_p, // Set the mtime so the fdcache file mtimes, even prefetched ones, // propagate to future webapi clients. - struct timeval tvs[2]; + struct timespec tvs[2]; tvs[0].tv_sec = tvs[1].tv_sec = archive_entry_mtime(e); - tvs[0].tv_usec = tvs[1].tv_usec = 0; - (void) futimes (fd, tvs); /* best effort */ + tvs[0].tv_nsec = tvs[1].tv_nsec = archive_entry_mtime_nsec(e); + (void) futimens (fd, tvs); /* best effort */ if (r != 0) // stage 3 { -- 2.40.0