diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-04-02 00:35:33 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-04-04 11:46:18 +0900 |
commit | 169d91b7276de4b05defb58700fb465fb53cf52a (patch) | |
tree | a9ceede334ace94a3e742f9cd7b55b90e9b205da /src | |
parent | 17f9d6d806ac59161ebd78afe4979e2c6138545f (diff) | |
download | systemd-169d91b7276de4b05defb58700fb465fb53cf52a.tar.gz |
sd-id128: rename argument and add missing assertion
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-id128/id128-util.c | 12 | ||||
-rw-r--r-- | src/libsystemd/sd-id128/id128-util.h | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/libsystemd/sd-id128/id128-util.c b/src/libsystemd/sd-id128/id128-util.c index a009a110a9..ab4108204e 100644 --- a/src/libsystemd/sd-id128/id128-util.c +++ b/src/libsystemd/sd-id128/id128-util.c @@ -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; diff --git a/src/libsystemd/sd-id128/id128-util.h b/src/libsystemd/sd-id128/id128-util.h index e094de6441..4be10bb310 100644 --- a/src/libsystemd/sd-id128/id128-util.h +++ b/src/libsystemd/sd-id128/id128-util.h @@ -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_; |