summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2017-04-28 13:09:39 +0200
committerQuentin Rameau <quinq@fifth.space>2017-04-28 13:09:39 +0200
commit0d1e670ac3e6a5ea02ff1c6a6e64263b425aef9c (patch)
tree601ac2665436155a023fa74c1453656a5d1882df /surf.c
parent3c2c0a65250e1415124603cb8d91bff4a657d46a (diff)
downloadsurf-0d1e670ac3e6a5ea02ff1c6a6e64263b425aef9c.tar.gz
surf-0d1e670ac3e6a5ea02ff1c6a6e64263b425aef9c.tar.bz2
surf-0d1e670ac3e6a5ea02ff1c6a6e64263b425aef9c.zip
Do not build SiteSpecific file when regex is invalid
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/surf.c b/surf.c
index d61534b..fcaa506 100644
--- a/surf.c
+++ b/surf.c
@@ -299,26 +299,28 @@ setup(void)
gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
for (i = 0; i < LENGTH(certs); ++i) {
- if (regcomp(&(certs[i].re), certs[i].regex, REG_EXTENDED)) {
+ if (!regcomp(&(certs[i].re), certs[i].regex, REG_EXTENDED)) {
+ certs[i].file = g_strconcat(certdir, "/", certs[i].file,
+ NULL);
+ } else {
fprintf(stderr, "Could not compile regex: %s\n",
certs[i].regex);
certs[i].regex = NULL;
}
- certs[i].file = g_strconcat(certdir, "/", certs[i].file, NULL);
}
if (!stylefile) {
styledir = buildpath(styledir);
for (i = 0; i < LENGTH(styles); ++i) {
- if (regcomp(&(styles[i].re), styles[i].regex,
+ if (!regcomp(&(styles[i].re), styles[i].regex,
REG_EXTENDED)) {
- fprintf(stderr,
- "Could not compile regex: %s\n",
+ styles[i].file = g_strconcat(styledir, "/",
+ styles[i].file, NULL);
+ } else {
+ fprintf(stderr, "Could not compile regex: %s\n",
styles[i].regex);
styles[i].regex = NULL;
}
- styles[i].file = g_strconcat(styledir, "/",
- styles[i].file, NULL);
}
g_free(styledir);
} else {
@@ -336,8 +338,7 @@ setup(void)
uriparams[i].config[j] = defconfig[j];
}
} else {
- fprintf(stderr,
- "Could not compile regex: %s\n",
+ fprintf(stderr, "Could not compile regex: %s\n",
uriparams[i].uri);
uriparams[i].uri = NULL;
}