]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-id128: rename argument and add missing assertion
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 1 Apr 2023 15:35:33 +0000 (00:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 4 Apr 2023 02:46:18 +0000 (11:46 +0900)
src/libsystemd/sd-id128/id128-util.c
src/libsystemd/sd-id128/id128-util.h

index a009a110a96fdfb58ba67443eb508a75fb59276b..ab4108204ecb4e51f89aed5e1c7f75cbeaf2223a 100644 (file)
@@ -101,10 +101,12 @@ int id128_read_fd(int fd, Id128FormatFlag f, sd_id128_t *ret) {
         return r == -EINVAL ? -EUCLEAN : r;
 }
 
-int id128_read(const char *p, Id128FormatFlag f, sd_id128_t *ret) {
+int id128_read(const char *path, Id128FormatFlag f, sd_id128_t *ret) {
         _cleanup_close_ int fd = -EBADF;
 
-        fd = open(p, O_RDONLY|O_CLOEXEC|O_NOCTTY);
+        assert(path);
+
+        fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY);
         if (fd < 0)
                 return -errno;
 
@@ -141,10 +143,12 @@ int id128_write_fd(int fd, Id128FormatFlag f, sd_id128_t id) {
         return 0;
 }
 
-int id128_write(const char *p, Id128FormatFlag f, sd_id128_t id) {
+int id128_write(const char *path, Id128FormatFlag f, sd_id128_t id) {
         _cleanup_close_ int fd = -EBADF;
 
-        fd = open(p, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY|O_TRUNC, 0444);
+        assert(path);
+
+        fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY|O_TRUNC, 0444);
         if (fd < 0)
                 return -errno;
 
index e094de64419406c11a3b6226f3a8ee8ca0378741..4be10bb3103bb0590a625b21fbb08bc6f6562a9c 100644 (file)
@@ -19,10 +19,10 @@ typedef enum Id128FormatFlag {
 } Id128FormatFlag;
 
 int id128_read_fd(int fd, Id128FormatFlag f, sd_id128_t *ret);
-int id128_read(const char *p, Id128FormatFlag f, sd_id128_t *ret);
+int id128_read(const char *path, Id128FormatFlag f, sd_id128_t *ret);
 
 int id128_write_fd(int fd, Id128FormatFlag f, sd_id128_t id);
-int id128_write(const char *p, Id128FormatFlag f, sd_id128_t id);
+int id128_write(const char *path, Id128FormatFlag f, sd_id128_t id);
 
 void id128_hash_func(const sd_id128_t *p, struct siphash *state);
 int id128_compare_func(const sd_id128_t *a, const sd_id128_t *b) _pure_;