[tin-dev] [PATCH] exit early if rc-dir doesn't exist and couldn't be created

Urs Janßen urs at tin.org
Sat Nov 11 17:57:45 CET 2023


=== modified file 'doc/TODO'
--- old/doc/TODO	2023-11-08 10:50:46 +0000
+++ new/doc/TODO	2023-11-11 16:47:15 +0000
@@ -1045,11 +1040,6 @@
    quote the realname part?
    [20021007 Urs Janssen <urs at tin.org>]
 
-o  setting TIN_HOMEDIR to a non-existent dir gives a "Filesystem full"
-   error-message (but doesn't force quit) instead of creating the dir. bug?
-   feature? if the later we should give a more exact error-message.
-   [20011112 Urs Janssen <urs at tin.org>]
-
 o  update gettext stuff to > gettext-0.12.1 (or drop it?)
 
 o  shows up cross-postings multiple times even if read once before getting

=== modified file 'src/init.c'
--- old/src/init.c	2023-11-08 12:48:52 +0000
+++ new/src/init.c	2023-11-11 16:46:30 +0000
@@ -878,8 +878,12 @@
 
 	joinpath(rcdir, sizeof(rcdir), homedir, RCDIR);
 	if (stat(rcdir, &sb) == -1) {
-		my_mkdir(rcdir, (mode_t) (S_IRWXU)); /* TODO: bail out? give error message? no_write = TRUE? */
-		created_rcdir = TRUE;
+		if (my_mkdir(rcdir, (mode_t) (S_IRWXU)) == -1) {
+			error_message(0, _(txt_cannot_create), rcdir);
+			free_all_arrays();
+			giveup();
+		} else
+			created_rcdir = TRUE;
 	}
 	strcpy(tinrc.mailer_format, MAILER_FORMAT);
 	my_strncpy(mailer, get_val(ENV_VAR_MAILER, DEFAULT_MAILER), sizeof(mailer) - 1);




More information about the tin-dev mailing list