diff options
author | Freeyorp <TheFreeYorp+git@gmail.com> | 2024-06-19 08:29:16 +0000 |
---|---|---|
committer | Freeyorp <TheFreeYorp+git@gmail.com> | 2024-06-19 08:34:03 +0000 |
commit | 4c0179e1c43972521e2e6d9299914603292abaf7 (patch) | |
tree | f564aea5e0ef56f35871d8976abc8d81471141a2 | |
parent | 64cb15b1109d409643fb43d6a5560c36205e29e8 (diff) | |
download | tmwa-4c0179e1c43972521e2e6d9299914603292abaf7.tar.gz tmwa-4c0179e1c43972521e2e6d9299914603292abaf7.tar.bz2 tmwa-4c0179e1c43972521e2e6d9299914603292abaf7.tar.xz tmwa-4c0179e1c43972521e2e6d9299914603292abaf7.zip |
shared: Explain why startup failed on conf fail
This prints out the filename and what it tried to do, rather than raising
SIGABRT and silently dumping a core.
-rw-r--r-- | src/shared/lib.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shared/lib.cpp b/src/shared/lib.cpp index 0eebf17..d7d1a4e 100644 --- a/src/shared/lib.cpp +++ b/src/shared/lib.cpp @@ -39,10 +39,16 @@ namespace tmwa { io::ReadFile rf(dirfd, filename); if (!rf.is_open()) + { + FPRINTF(stderr, "Could not open %s\n"_fmt, filename); abort(); + } AString line; if (!rf.getline(line)) + { + FPRINTF(stderr, "Could not read from %s\n"_fmt, filename); abort(); + } } static @@ -50,10 +56,16 @@ namespace tmwa { io::WriteFile wf(dirfd, filename); if (!wf.is_open()) + { + FPRINTF(stderr, "Could not open %s\n"_fmt, filename); abort(); + } wf.put_line("Hello, World!"_s); if (!wf.close()) + { + FPRINTF(stderr, "Could not write to %s\n"_fmt, filename); abort(); + } } void check_paths() |