summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/subst.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tar/subst.c')
-rw-r--r--usr.bin/tar/subst.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/tar/subst.c b/usr.bin/tar/subst.c
index a217293..765f74b 100644
--- a/usr.bin/tar/subst.c
+++ b/usr.bin/tar/subst.c
@@ -58,7 +58,7 @@ init_substitution(struct bsdtar *bsdtar)
bsdtar->substitution = subst = malloc(sizeof(*subst));
if (subst == NULL)
- bsdtar_errc(1, errno, "Out of memory");
+ lafe_errc(1, errno, "Out of memory");
subst->first_rule = subst->last_rule = NULL;
}
@@ -78,7 +78,7 @@ add_substitution(struct bsdtar *bsdtar, const char *rule_text)
rule = malloc(sizeof(*rule));
if (rule == NULL)
- bsdtar_errc(1, errno, "Out of memory");
+ lafe_errc(1, errno, "Out of memory");
rule->next = NULL;
if (subst->last_rule == NULL)
@@ -88,32 +88,32 @@ add_substitution(struct bsdtar *bsdtar, const char *rule_text)
subst->last_rule = rule;
if (*rule_text == '\0')
- bsdtar_errc(1, 0, "Empty replacement string");
+ lafe_errc(1, 0, "Empty replacement string");
end_pattern = strchr(rule_text + 1, *rule_text);
if (end_pattern == NULL)
- bsdtar_errc(1, 0, "Invalid replacement string");
+ lafe_errc(1, 0, "Invalid replacement string");
pattern = malloc(end_pattern - rule_text);
if (pattern == NULL)
- bsdtar_errc(1, errno, "Out of memory");
+ lafe_errc(1, errno, "Out of memory");
memcpy(pattern, rule_text + 1, end_pattern - rule_text - 1);
pattern[end_pattern - rule_text - 1] = '\0';
if ((r = regcomp(&rule->re, pattern, REG_BASIC)) != 0) {
char buf[80];
regerror(r, &rule->re, buf, sizeof(buf));
- bsdtar_errc(1, 0, "Invalid regular expression: %s", buf);
+ lafe_errc(1, 0, "Invalid regular expression: %s", buf);
}
free(pattern);
start_subst = end_pattern + 1;
end_pattern = strchr(start_subst, *rule_text);
if (end_pattern == NULL)
- bsdtar_errc(1, 0, "Invalid replacement string");
+ lafe_errc(1, 0, "Invalid replacement string");
rule->result = malloc(end_pattern - start_subst + 1);
if (rule->result == NULL)
- bsdtar_errc(1, errno, "Out of memory");
+ lafe_errc(1, errno, "Out of memory");
memcpy(rule->result, start_subst, end_pattern - start_subst);
rule->result[end_pattern - start_subst] = '\0';
@@ -136,7 +136,7 @@ add_substitution(struct bsdtar *bsdtar, const char *rule_text)
rule->symlink = 1;
break;
default:
- bsdtar_errc(1, 0, "Invalid replacement flag %c", *end_pattern);
+ lafe_errc(1, 0, "Invalid replacement flag %c", *end_pattern);
}
}
}
@@ -154,7 +154,7 @@ realloc_strncat(char **str, const char *append, size_t len)
new_str = malloc(old_len + len + 1);
if (new_str == NULL)
- bsdtar_errc(1, errno, "Out of memory");
+ lafe_errc(1, errno, "Out of memory");
memcpy(new_str, *str, old_len);
memcpy(new_str + old_len, append, len);
new_str[old_len + len] = '\0';
@@ -175,7 +175,7 @@ realloc_strcat(char **str, const char *append)
new_str = malloc(old_len + strlen(append) + 1);
if (new_str == NULL)
- bsdtar_errc(1, errno, "Out of memory");
+ lafe_errc(1, errno, "Out of memory");
memcpy(new_str, *str, old_len);
strcpy(new_str + old_len, append);
free(*str);
OpenPOWER on IntegriCloud