aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--cgit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index c33e6fc..42beace 100644
--- a/cgit.c
+++ b/cgit.c
@@ -789,7 +789,9 @@ static char *build_snapshot_setting(int bitmap)
static char *get_first_line(char *txt)
{
char *t = xstrdup(txt);
- *strchrnul(t, '\n') = '\0';
+ char *p = strchr(t, '\n');
+ if (p)
+ *p = '\0';
return t;
}