From 5e0c2006088358e13ebabeeb185ae88b852a8691 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 13 Aug 2023 11:10:50 +0800 Subject: [PATCH] Fix the MS-DOS build * msdos/sedlibmk.inp (OMIT_GNULIB_MODULE_boot-time): Define to true. * src/filelock.c (get_boot_sec) [MSDOS]: Return 0; this information is probably unavailable. It is also irrelevant as MS-DOS is a single-process operating system. --- msdos/sedlibmk.inp | 1 + src/filelock.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index f3554e7b001..664bfaf693c 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp @@ -489,6 +489,7 @@ OMIT_GNULIB_MODULE_strtoll = true\ OMIT_GNULIB_MODULE_symlink = true\ OMIT_GNULIB_MODULE_sys_select = true\ OMIT_GNULIB_MODULE_sys_time = true\ +OMIT_GNULIB_MODULE_boot-time = true\ OMIT_GNULIB_MODULE_crypto\/md5 = true /^arg-nonnull\.h:/,/^[ ][ ]*mv /c\ arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h\ diff --git a/src/filelock.c b/src/filelock.c index d2161f1e58a..f3075b93322 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -107,7 +107,8 @@ along with GNU Emacs. If not, see . */ hard nor symbolic links. */ -/* Return the time of the last system boot. */ +/* Return the time of the last system boot, or 0 if that information + is unavailable. */ static time_t get_boot_sec (void) @@ -117,10 +118,16 @@ get_boot_sec (void) if (will_dump_p ()) return 0; - struct timespec boot_time; - boot_time.tv_sec = 0; - get_boot_time (&boot_time); - return boot_time.tv_sec; +#ifndef MSDOS + { + struct timespec boot_time; + boot_time.tv_sec = 0; + get_boot_time (&boot_time); + return boot_time.tv_sec; + } +#else /* MSDOS */ + return 0; +#endif /* MSDOS */ } /* An arbitrary limit on lock contents length. 8 K should be plenty -- 2.39.2