about summary refs log tree commit diff
path: root/xdg.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-05-12 12:44:38 -0400
committerJune McEnroe <june@causal.agency>2020-05-12 12:44:38 -0400
commit4fea54637bb8eef89fb08cff21788bf3565a54ee (patch)
tree070a6e3bef3195714b04e31da084b06f4687297e /xdg.c
parentMark global variables in chat.h as extern (diff)
downloadcatgirl-4fea54637bb8eef89fb08cff21788bf3565a54ee.tar.gz
catgirl-4fea54637bb8eef89fb08cff21788bf3565a54ee.zip
Do not stop when files in XDG dirs are inaccessible
> When attempting to read a file, if for any reason a file in a certain
> directory is unaccessible, e.g. because the directory is non-existant,
> the file is non-existant or the user is not authorized to open the file,
> then the processing of the file in that directory should be skipped. If
> due to this a required file could not be found at all, the application
> may chose to present an error message to the user.
Diffstat (limited to 'xdg.c')
-rw-r--r--xdg.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/xdg.c b/xdg.c
index c70873a..ee51ed5 100644
--- a/xdg.c
+++ b/xdg.c
@@ -42,10 +42,7 @@ FILE *configOpen(const char *path, const char *mode) {
 	}
 	FILE *file = fopen(buf, mode);
 	if (file) return file;
-	if (errno != ENOENT) {
-		warn("%s", buf);
-		return NULL;
-	}
+	if (errno != ENOENT) warn("%s", buf);
 
 	if (!configDirs) configDirs = "/etc/xdg";
 	while (*configDirs) {
@@ -56,10 +53,7 @@ FILE *configOpen(const char *path, const char *mode) {
 		);
 		file = fopen(buf, mode);
 		if (file) return file;
-		if (errno != ENOENT) {
-			warn("%s", buf);
-			return NULL;
-		}
+		if (errno != ENOENT) warn("%s", buf);
 		configDirs += len;
 		if (*configDirs) configDirs++;
 	}
@@ -92,10 +86,7 @@ FILE *dataOpen(const char *path, const char *mode) {
 	}
 	FILE *file = fopen(homePath, mode);
 	if (file) return file;
-	if (errno != ENOENT) {
-		warn("%s", homePath);
-		return NULL;
-	}
+	if (errno != ENOENT) warn("%s", homePath);
 
 	char buf[PATH_MAX];
 	if (!dataDirs) dataDirs = "/usr/local/share:/usr/share";
@@ -107,10 +98,7 @@ FILE *dataOpen(const char *path, const char *mode) {
 		);
 		file = fopen(buf, mode);
 		if (file) return file;
-		if (errno != ENOENT) {
-			warn("%s", buf);
-			return NULL;
-		}
+		if (errno != ENOENT) warn("%s", buf);
 		dataDirs += len;
 		if (*dataDirs) dataDirs++;
 	}
c56c81&follow=1'>Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe Hack: output an extra <td> after rendering mdoc so that line numbers can be hidden based on there being three. This required splitting source-filter and about-filter since on about pages there is no table. 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe :target persists after you click on something else. 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe NULs in the input cause an infinite loop in htmlEscape, not to mention regexes obviously not working, etc. 2019-12-16Post "cgit setup"June McEnroe