diff options
| author | Thomas Weißschuh <thomas@t-8ch.de> | 2024-05-13 21:01:16 +0200 |
|---|---|---|
| committer | Thomas Weißschuh <thomas@t-8ch.de> | 2024-05-13 21:02:23 +0200 |
| commit | 1a45153e46297451d7a79c4708d823ff64c8c514 (patch) | |
| tree | d12ccd048f74656f984b097edfb37a145ab383b4 /lib/path.c | |
| parent | d4fc7055ca11fad8f7664c5f28ef6c9622acb166 (diff) | |
| download | util-linux-1a45153e46297451d7a79c4708d823ff64c8c514.tar.gz | |
lib/path: introduce ul_path_vreadf_buffer
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Diffstat (limited to 'lib/path.c')
| -rw-r--r-- | lib/path.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/path.c b/lib/path.c index 6381cc5d8f..6a70ad45f7 100644 --- a/lib/path.c +++ b/lib/path.c @@ -701,16 +701,25 @@ int ul_path_read_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char return rc; } -int ul_path_readf_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char *path, ...) +int ul_path_vreadf_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char *path, va_list ap) { const char *p; + + p = ul_path_mkpath(pc, path, ap); + + return !p ? -errno : ul_path_read_buffer(pc, buf, bufsz, p); +} + +int ul_path_readf_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char *path, ...) +{ va_list ap; + int rc; va_start(ap, path); - p = ul_path_mkpath(pc, path, ap); + rc = ul_path_vreadf_buffer(pc, buf, bufsz, path, ap); va_end(ap); - return !p ? -errno : ul_path_read_buffer(pc, buf, bufsz, p); + return rc; } int ul_path_scanf(struct path_cxt *pc, const char *path, const char *fmt, ...) |
