summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-05-30 04:20:26 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-05-31 01:13:17 +0100
commitf4021bd84ba008fd1a6b1d21a9782b97fb26120f (patch)
tree1f51861fbe721185241a3859fcfe1dc3da6b820a
parent165aa899bc9d1ea0bebb7b08351582dfeff8bbde (diff)
File a complaint about the error message situation
-rw-r--r--TODO/errmsg11
-rw-r--r--src/demorec.c10
2 files changed, 17 insertions, 4 deletions
diff --git a/TODO/errmsg b/TODO/errmsg
new file mode 100644
index 0000000..51b8aae
--- /dev/null
+++ b/TODO/errmsg
@@ -0,0 +1,11 @@
+Come up with a better error logging abstraction
+====
+Something like the BSD err/warn/errx/warnx maybe, although taking into account
+all the stupid Windows GetLastError differences too. As it stands, different
+source files have different ways of prefixing messages, a lot of strings are
+pretty redundant (would maybe be nice to have something closer to the DJB-style
+concatenated string messages to solve that problem?), and almost nothing bothers
+to include the actual system error string because doing so is currently doing
+annoying.
+
+pls fix
diff --git a/src/demorec.c b/src/demorec.c
index a7e0486..dc9e899 100644
--- a/src/demorec.c
+++ b/src/demorec.c
@@ -128,9 +128,9 @@ static void hook_record_cb(const struct con_cmdargs *args) {
return;
}
if (!S_ISDIR(s.st_mode)) {
- // duping this warning call to avoid duping the string data,
- // very stupid, oh well. if/when we have New And Improved
- // Logging this can be tidied up...
+ // TODO(errmsg): duping this warning call to avoid duping
+ // the string data, very stupid, oh well. if/when we have
+ // New And Improved Logging this can be tidied up...
con_warn("ERROR: can't record demo: ");
con_warn("the path %.*s is not a directory\n",
argdirlen, arg);
@@ -235,13 +235,15 @@ bool demorec_init(void) {
void **vtable = *(void ***)demorecorder;
// XXX: 16 is totally arbitrary here! figure out proper bounds later
if (!os_mprot(vtable, 16 * sizeof(void *), PAGE_READWRITE)) {
+ // TODO(errmsg): this is one of the only places I apparently bothered
+ // to properly log this stuff. really should solve this at some point
#ifdef _WIN32
char err[128];
OS_WINDOWS_ERROR(err);
#else
const char *err = strerror(errno);
#endif
- con_warn("demorec: couldn't unprotect CDemoRecorder vtable: %s\n", err);
+ con_warn("demorec: couldn't make memory writable: %s\n", err);
return false;
}
if (!find_recmembers(vtable[vtidx_StopRecording])) {