summaryrefslogtreecommitdiffstats
path: root/src/bfstd.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-01-13 15:54:46 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-01-13 15:54:46 -0500
commite766015d60c927aae03b8e43d956c6976c16b2ba (patch)
tree796b0ab4c94d3cf5e8c12b4d263e054eb04f6bcd /src/bfstd.c
parente9588c49d5539ded993f720fc6855d6fa878c997 (diff)
downloadbfs-e766015d60c927aae03b8e43d956c6976c16b2ba.tar.xz
ioq: Use the negative errno convention
Diffstat (limited to 'src/bfstd.c')
-rw-r--r--src/bfstd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bfstd.c b/src/bfstd.c
index 15e8667..0a9b87c 100644
--- a/src/bfstd.c
+++ b/src/bfstd.c
@@ -59,6 +59,15 @@ bool errno_is_like(int category) {
return error_is_like(errno, category);
}
+int try(int ret) {
+ if (ret >= 0) {
+ return ret;
+ } else {
+ bfs_assert(errno > 0, "errno should be positive, was %d\n", errno);
+ return -errno;
+ }
+}
+
char *xdirname(const char *path) {
size_t i = xbaseoff(path);