diff options
| -rw-r--r-- | README | 4 | ||||
| -rw-r--r-- | config.mk | 4 | ||||
| -rw-r--r-- | liberror-libc.h | 6 | ||||
| -rw-r--r-- | lseek.c | 6 | ||||
| -rw-r--r-- | pipe.c | 4 | ||||
| -rw-r--r-- | recv.c | 2 | ||||
| -rw-r--r-- | send.c | 10 |
7 files changed, 19 insertions, 17 deletions
@@ -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. @@ -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; @@ -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; @@ -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 = ""; @@ -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; @@ -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; |
