]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
storagetm: always hash stat.st_mode
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jan 2024 20:07:40 +0000 (05:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jan 2024 20:07:43 +0000 (05:07 +0900)
To make the hash function consistent with the compare function.

src/storagetm/storagetm.c

index b28924a8b456eaf73dfe24a8a0d4d419c275a3c9..c8948ec03895de697a3db04ba3b046ffa3a29758 100644 (file)
@@ -788,9 +788,10 @@ typedef struct Context {
 static void device_hash_func(const struct stat *q, struct siphash *state) {
         assert(q);
 
+        mode_t m = q->st_mode & S_IFMT;
+        siphash24_compress_typesafe(m, state);
+
         if (S_ISBLK(q->st_mode) || S_ISCHR(q->st_mode)) {
-                mode_t m = q->st_mode & S_IFMT;
-                siphash24_compress_typesafe(m, state);
                 siphash24_compress_typesafe(q->st_rdev, state);
                 return;
         }