aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binlogsel.c4
-rw-r--r--src/xalloc.c5
-rw-r--r--src/xalloc.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/src/binlogsel.c b/src/binlogsel.c
index 547b4ec..80f5b83 100644
--- a/src/binlogsel.c
+++ b/src/binlogsel.c
@@ -68,7 +68,7 @@ void selglob(const char *dir, const char *pattern);
struct interval {
struct interval *next;
- const char *name;
+ char *name;
int timemask;
time_t start;
time_t end;
@@ -81,7 +81,7 @@ interval_add(const char *name, int tmask, time_t start, time_t end)
{
struct interval *p = xmalloc(sizeof(*p));
p->next = NULL;
- p->name = name;
+ p->name = xstrdup(name);
p->timemask = tmask;
p->start = start;
p->end = end;
diff --git a/src/xalloc.c b/src/xalloc.c
index d12a04c..6ab6802 100644
--- a/src/xalloc.c
+++ b/src/xalloc.c
@@ -49,5 +49,10 @@ xmemdup(void const *p, size_t s)
return memcpy(xmalloc(s), p, s);
}
+char *
+xstrdup(const char *s)
+{
+ return xmemdup(s, strlen(s) + 1);
+}
diff --git a/src/xalloc.h b/src/xalloc.h
index da7922f..eb49573 100644
--- a/src/xalloc.h
+++ b/src/xalloc.h
@@ -1,3 +1,4 @@
void *xmalloc(size_t s);
void *xmemdup(void const *p, size_t s);
void *xcalloc(size_t count, size_t size);
+char *xstrdup(const char *s);

Return to:

Send suggestions and report system problems to the System administrator.