diff options
| author | Paul Eggert | 2023-08-09 12:06:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2023-08-09 12:15:47 -0700 |
| commit | cc0a30a876adffa5ec110df9f4e0f21097f6d73e (patch) | |
| tree | 024bc0acb8de48aebed591b25aeb02508038272d | |
| parent | 020b5d7fefd255117ab4fca636146b5b59c8fb84 (diff) | |
| download | emacs-cc0a30a876adffa5ec110df9f4e0f21097f6d73e.tar.gz emacs-cc0a30a876adffa5ec110df9f4e0f21097f6d73e.zip | |
Adjust to random-seed move
For some time, GNU/Linux systems have put their random-seed file
somewhere other than where src/filelock.c looks for it.
Catch up to this by having 'configure' scout for it.
* configure.ac (BOOT_TIME_FILE):
Define this at configure-time.
* nt/inc/ms-w32.h (BOOT_TIME_FILE): Override 'configure'.
* src/filelock.c (BOOT_TIME_FILE): Remove default definition,
since 'configure' defaults it now.
| -rw-r--r-- | configure.ac | 31 | ||||
| -rw-r--r-- | nt/inc/ms-w32.h | 1 | ||||
| -rw-r--r-- | src/filelock.c | 6 |
3 files changed, 32 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 6e080c1c666..56c8cf1ae05 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -2625,6 +2625,37 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then | |||
| 2625 | fi | 2625 | fi |
| 2626 | AC_SUBST([AUTO_DEPEND]) | 2626 | AC_SUBST([AUTO_DEPEND]) |
| 2627 | 2627 | ||
| 2628 | AC_CACHE_CHECK([for old but post-boot file], | ||
| 2629 | [emacs_cv_boot_time_file], | ||
| 2630 | [AS_CASE([$opsys], | ||
| 2631 | [*bsd|darwin|dragonfly], | ||
| 2632 | [emacs_cv_boot_time_file='not needed'], | ||
| 2633 | [emacs_cv_boot_time_file=unknown | ||
| 2634 | AS_IF([test $cross_compiling = no], | ||
| 2635 | [# systemd puts it in /var/lib/systemd. | ||
| 2636 | # initscripts puts it in /var/lib/urandom (previously /var/lib). | ||
| 2637 | # Linux drivers/char/random.c before 2022-02-21 suggests /var/run. | ||
| 2638 | for file in \ | ||
| 2639 | /var/lib/systemd/random-seed \ | ||
| 2640 | /var/lib/urandom/random-seed \ | ||
| 2641 | /var/lib/random-seed \ | ||
| 2642 | /var/run/random-seed | ||
| 2643 | do | ||
| 2644 | test -f $file && { emacs_cv_boot_time_file=$file; break; } | ||
| 2645 | done])])]) | ||
| 2646 | AS_CASE([$emacs_cv_boot_time_file], | ||
| 2647 | [/*|*:*], [BOOT_TIME_FILE=\"$emacs_cv_boot_time_file\"], | ||
| 2648 | [NULL|nullptr|0], [BOOT_TIME_FILE=$emacs_cv_boot_time_file], | ||
| 2649 | ['not needed'], [BOOT_TIME_FILE=NULL], | ||
| 2650 | [# Guess systemd if unknown. | ||
| 2651 | # If guess is wrong, Emacs falls back on something else. | ||
| 2652 | BOOT_TIME_FILE=\"/var/lib/systemd/random-seed\"]) | ||
| 2653 | AC_DEFINE_UNQUOTED([BOOT_TIME_FILE], [$BOOT_TIME_FILE], | ||
| 2654 | [Name of file that, if it exists, postdates boot and predates | ||
| 2655 | the first Emacs invocation; or a null pointer if no such file is known. | ||
| 2656 | This file is used only on GNU/Linux and other systems | ||
| 2657 | that lack the FreeBSD-style sysctl with KERN_BOOTTIME.]) | ||
| 2658 | |||
| 2628 | #### Choose a window system. | 2659 | #### Choose a window system. |
| 2629 | 2660 | ||
| 2630 | ## We leave window_system equal to none if | 2661 | ## We leave window_system equal to none if |
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 58be1199345..b23fd5030fa 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h | |||
| @@ -121,6 +121,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 121 | the output, but that's gross. So this should do; if the file is | 121 | the output, but that's gross. So this should do; if the file is |
| 122 | not there, the boot time will be returned as zero, and filelock.c | 122 | not there, the boot time will be returned as zero, and filelock.c |
| 123 | already handles that. */ | 123 | already handles that. */ |
| 124 | #undef BOOT_TIME_FILE | ||
| 124 | #define BOOT_TIME_FILE "C:/pagefile.sys" | 125 | #define BOOT_TIME_FILE "C:/pagefile.sys" |
| 125 | 126 | ||
| 126 | /* ============================================================ */ | 127 | /* ============================================================ */ |
diff --git a/src/filelock.c b/src/filelock.c index 66b8fd2ceac..0ad130353f3 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -59,12 +59,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 59 | #include <utmp.h> | 59 | #include <utmp.h> |
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| 62 | /* A file whose last-modified time is just after the most recent boot. | ||
| 63 | Define this to be NULL to disable checking for this file. */ | ||
| 64 | #ifndef BOOT_TIME_FILE | ||
| 65 | #define BOOT_TIME_FILE "/var/run/random-seed" | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /* Boot time is not available on Android. */ | 62 | /* Boot time is not available on Android. */ |
| 69 | 63 | ||
| 70 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY | 64 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY |