diff options
| author | Karel Zak <kzak@redhat.com> | 2024-01-08 10:32:54 +0100 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2024-01-08 10:32:54 +0100 |
| commit | a002df07ac15c370381cb44f06afeaa333685780 (patch) | |
| tree | e6976408eeb5231bf20743c02ed41f9cd3ca613c /libmount/src | |
| parent | c14bee4d44ac8c61d56028f2f032e35c32533c38 (diff) | |
| download | util-linux-a002df07ac15c370381cb44f06afeaa333685780.tar.gz | |
libmount: don't assume errno after failed asprintf()
Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
| -rw-r--r-- | libmount/src/monitor.c | 2 | ||||
| -rw-r--r-- | libmount/src/tab_update.c | 2 | ||||
| -rw-r--r-- | libmount/src/utils.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/libmount/src/monitor.c b/libmount/src/monitor.c index 0e08c9eb57..ef53b6d69d 100644 --- a/libmount/src/monitor.c +++ b/libmount/src/monitor.c @@ -229,7 +229,7 @@ static int userspace_add_watch(struct monitor_entry *me, int *final, int *fd) * libmount uses utab.event file to monitor and control utab updates */ if (asprintf(&filename, "%s.event", me->path) <= 0) { - rc = -errno; + rc = -ENOMEM; goto done; } diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c index 67baa8ead4..6a2c77b39c 100644 --- a/libmount/src/tab_update.c +++ b/libmount/src/tab_update.c @@ -1013,7 +1013,7 @@ int mnt_update_emit_event(struct libmnt_update *upd) return -EINVAL; if (asprintf(&filename, "%s.event", upd->filename) <= 0) - return -errno; + return -ENOMEM; fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC, S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH); diff --git a/libmount/src/utils.c b/libmount/src/utils.c index f301f3f567..a2f8ea0337 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -1032,7 +1032,7 @@ int mnt_open_uniq_filename(const char *filename, char **name) rc = asprintf(&n, "%s.XXXXXX", filename); if (rc <= 0) - return -errno; + return -ENOMEM; /* This is for very old glibc and for compatibility with Posix, which says * nothing about mkstemp() mode. All sane glibc use secure mode (0600). |
