From 6648e5a80e33bdae4ba70c81231a2a28ac7b4411 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 22 Feb 2026 13:55:02 +0100 Subject: m fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- README | 4 ++-- config.mk | 4 +++- liberror-libc.h | 6 +++--- lseek.c | 6 +++--- pipe.c | 4 ++-- recv.c | 2 +- send.c | 10 +++++----- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README b/README index af13443..efde204 100644 --- a/README +++ b/README @@ -1,2 +1,2 @@ -This library provide wrappers for most standard C library -functions that can fail providing liberror errors. +This library provides wrappers for most standard C library +functions that can fail, providing liberror errors. diff --git a/config.mk b/config.mk index c9a4302..a4f2ca7 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,8 @@ PREFIX = /usr MANPREFIX = $(PREFIX)/share/man +CC = c99 + CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -CFLAGS = -std=c99 -Wall -pedantic +CFLAGS = LDFLAGS = -s -lerror diff --git a/liberror-libc.h b/liberror-libc.h index 7b99d93..7726d69 100644 --- a/liberror-libc.h +++ b/liberror-libc.h @@ -18,9 +18,9 @@ #define _LIBERROR_CONST _LIBERROR_GCC_ONLY(__attribute__((__const__))) -#define LIBERROR_LIBC_ERRROR_SHORT_READ -1 -#define LIBERROR_LIBC_ERRROR_SHORT_SEEK -2 -#define LIBERROR_LIBC_ERRROR_SHORT_WRITE -3 +#define LIBERROR_LIBC_ERROR_SHORT_READ -1 +#define LIBERROR_LIBC_ERROR_SHORT_SEEK -2 +#define LIBERROR_LIBC_ERROR_SHORT_WRITE -3 typedef int64_t _liberror_off_t; diff --git a/lseek.c b/lseek.c index 53f46e1..8dbbe0c 100644 --- a/lseek.c +++ b/lseek.c @@ -64,7 +64,7 @@ liberror_lseek_failed(int fd, _liberror_off_t offset, int whence, const char *fn desc = ""; break; } - liberror_libc_set_error_one_file(desc, "sockatmark", "Seekable file", fd, fname); + liberror_libc_set_error_one_file(desc, "lseek", "Seekable file", fd, fname); errno = saved_errno; } @@ -80,11 +80,11 @@ liberror_lseek_short(int fd, _liberror_off_t offset, int whence, _liberror_uoff_ if (returned < 0 || (_liberror_uoff_t)returned < min) { desc = "Seek resulted in a new offset in an earlier position than expected"; } else if ((_liberror_uoff_t)returned > max) { - desc = "Seek resulted in a new offset in an beyond the expectation"; + desc = "Seek resulted in a new offset beyond expectations"; } else { desc = "Seek resulted in an unexpected new offset"; } - liberror_set_error(desc, "recv", "liberror-libc", LIBERROR_LIBC_ERRROR_SHORT_SEEK); + liberror_set_error(desc, "lseek", "liberror-libc", LIBERROR_LIBC_ERROR_SHORT_SEEK); error = liberror_get_error(); error->details_type = LIBERROR_DETAILS_ONE_FILE; error->details.one_file.fd = fd; diff --git a/pipe.c b/pipe.c index a0cd32f..058201c 100644 --- a/pipe.c +++ b/pipe.c @@ -14,10 +14,10 @@ liberror_pipe_failed(int fds[2]) desc = "Output parameter is an invalid pointer"; break; case EMFILE: - desc = "The process have too many file descriptors open"; + desc = "The process has too many file descriptors open"; break; case ENFILE: - desc = "The system have too many file descriptors open"; + desc = "The system has too many file descriptors open"; break; default: desc = ""; diff --git a/recv.c b/recv.c index 831850a..3317cd0 100644 --- a/recv.c +++ b/recv.c @@ -129,7 +129,7 @@ liberror_recv_short(int fd, void *buf, size_t n, int flags, size_t min, size_t m } else { desc = "Received message was of an unexpected size"; } - liberror_set_error(desc, "recv", "liberror-libc", LIBERROR_LIBC_ERRROR_SHORT_READ); + liberror_set_error(desc, "recv", "liberror-libc", LIBERROR_LIBC_ERROR_SHORT_READ); error = liberror_get_error(); error->details_type = LIBERROR_DETAILS_ONE_FILE; error->details.one_file.fd = fd; diff --git a/send.c b/send.c index 62c12a7..1878451 100644 --- a/send.c +++ b/send.c @@ -38,7 +38,7 @@ liberror_send_failed(int fd, const void *buf, size_t n, int flags, const char *f #endif #if defined(EAGAIN) || defined(EWOULDBLOCK) desc = "Attempting to send in nonblocking mode but the operation would block " - "or the socket is unbound and all ephemeral ports are currently in used"; + "or the socket is unbound and all ephemeral ports are currently in use"; # if defined(EAGAIN) # if defined(EWOULDBLOCK) && (EAGAIN != EWOULDBLOCK) if (errno == EAGAIN) { @@ -62,7 +62,7 @@ liberror_send_failed(int fd, const void *buf, size_t n, int flags, const char *f errno = saved_errno; # if defined(EWOULDBLOCK) && (EAGAIN != EWOULDBLOCK) } else { - goto first_case_in_eagain: + goto first_case_in_eagain; } # endif # endif @@ -102,13 +102,13 @@ liberror_send_failed(int fd, const void *buf, size_t n, int flags, const char *f desc = "The recipient is specified but the socket is already connected"; break; case EMSGSIZE: - desc = "Message is to large to be sent atomically as required by the socket type"; + desc = "Message is too large to be sent atomically as required by the socket type"; break; case ENETDOWN: desc = "All local network interfaces that can be used to reach the destination are down"; break; case ENETUNREACH: - desc = "No route to the network it present"; + desc = "No route to the network is present"; break; case ENOBUFS: desc = "Insufficient resource available in the system to perform the operation"; @@ -162,7 +162,7 @@ liberror_send_short(int fd, const void *buf, size_t n, int flags, size_t min, si } else { desc = "Sent message was of an unexpected size"; } - liberror_set_error(desc, "send", "liberror-libc", LIBERROR_LIBC_ERRROR_SHORT_WRITE); + liberror_set_error(desc, "send", "liberror-libc", LIBERROR_LIBC_ERROR_SHORT_WRITE); error = liberror_get_error(); error->details_type = LIBERROR_DETAILS_ONE_FILE; error->details.one_file.fd = fd; -- cgit v1.2.3-70-g09d2