]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
uuidd: fix open/lock state issue
authorKarel Zak <kzak@redhat.com>
Mon, 24 Jan 2022 13:08:08 +0000 (14:08 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 24 Jan 2022 13:08:08 +0000 (14:08 +0100)
* warn on open/lock state issue
* remove ProtectSystem=strict from systemd service setting, because it
  makes clock state file read-only

  openat(AT_FDCWD, "/var/lib/libuuid/clock.txt",
     O_RDWR|O_CREAT|O_CLOEXEC, 0660) = -1 EROFS (Read-only file system)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2040366
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/uuidd.c
misc-utils/uuidd.service.in

index f8b595ea7bef1664551364f8db2039a52a9821ab..dfcd1487bf26f2b021b0111c52294e11388d2387 100644 (file)
@@ -494,7 +494,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                        break;
                case UUIDD_OP_TIME_UUID:
                        num = 1;
-                       __uuid_generate_time(uu, &num);
+                       if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet)
+                               warnx(_("failed to open/lock clock counter"));
                        if (uuidd_cxt->debug) {
                                uuid_unparse(uu, str);
                                fprintf(stderr, _("Generated time UUID: %s\n"), str);
@@ -504,7 +505,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                        break;
                case UUIDD_OP_RANDOM_UUID:
                        num = 1;
-                       __uuid_generate_random(uu, &num);
+                       if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet)
+                               warnx(_("failed to open/lock clock counter"));
                        if (uuidd_cxt->debug) {
                                uuid_unparse(uu, str);
                                fprintf(stderr, _("Generated random UUID: %s\n"), str);
@@ -513,7 +515,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                        reply_len = sizeof(uu);
                        break;
                case UUIDD_OP_BULK_TIME_UUID:
-                       __uuid_generate_time(uu, &num);
+                       if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet)
+                               warnx(_("failed to open/lock clock counter"));
                        if (uuidd_cxt->debug) {
                                uuid_unparse(uu, str);
                                fprintf(stderr, P_("Generated time UUID %s "
index b4c9c463500c064b0efa58c92b91b6123d0dea13..065b4a194771be34f07cb408ef9773eb9ceb260d 100644 (file)
@@ -8,7 +8,6 @@ ExecStart=@usrsbin_execdir@/uuidd --socket-activation
 Restart=no
 User=uuidd
 Group=uuidd
-ProtectSystem=strict
 ProtectHome=yes
 PrivateDevices=yes
 PrivateNetwork=yes