summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ignore.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ignore.c b/ignore.c
index 7fecb16..d53d138 100644
--- a/ignore.c
+++ b/ignore.c
@@ -45,17 +45,19 @@ const char *ignoreAdd(const char *pattern) {
 		if (*ch == ' ') sp++;
 	}
 	char **dest = &ignore.patterns[ignore.len++];
+	int n = 0;
 	if (!ex && !sp) {
-		asprintf(dest, "%s!*@* * * *", pattern);
+		n = asprintf(dest, "%s!*@* * * *", pattern);
 	} else if (sp < 1) {
-		asprintf(dest, "%s * * *", pattern);
+		n = asprintf(dest, "%s * * *", pattern);
 	} else if (sp < 2) {
-		asprintf(dest, "%s * *", pattern);
+		n = asprintf(dest, "%s * *", pattern);
 	} else if (sp < 3) {
-		asprintf(dest, "%s *", pattern);
+		n = asprintf(dest, "%s *", pattern);
 	} else {
 		*dest = strdup(pattern);
 	}
+	if (n < 0) err(EX_OSERR, "asprintf");
 	if (!*dest) err(EX_OSERR, "strdup");
 	return *dest;
 }
/td> 2020-11-22Day 9, part 2June McEnroe 2020-11-22Day 9June McEnroe I was really sick at the start of the week, okay? 2020-11-22Day 8, part 2June McEnroe 2020-11-22Day 8June McEnroe 2020-11-22Day 7, part 2June McEnroe I don't even know what this is. Don't look at it. 2020-11-22Day 7June McEnroe 2020-11-22Day 6, part 2June McEnroe 2020-11-22Day 6June McEnroe 2020-11-22Day 5, part 2June McEnroe 2020-11-22Day 5June McEnroe 2020-11-22Day 4, part 2June McEnroe That ugly sort map though. 2020-11-22Day 4June McEnroe 2020-11-22Day 3, part 2June McEnroe I am super surprised that worked on the first try. 2020-11-22Day 3, clean upJune McEnroe 2020-11-22Day 3June McEnroe This is fucking awful and I'm angry. 2020-11-22Day 2, part 2June McEnroe 2020-11-22Day 2June McEnroe 2020-11-22Day 1, part 2June McEnroe 2020-11-22Day 1June McEnroe 2020-11-22Move to 2016 directoryJune McEnroe