supervise-daemon: convert snprintf calls to xasprintf
This commit is contained in:
parent
f9d41243d8
commit
e14edd765f
@ -186,7 +186,6 @@ static void handle_signal(int sig)
|
|||||||
static char * expand_home(const char *home, const char *path)
|
static char * expand_home(const char *home, const char *path)
|
||||||
{
|
{
|
||||||
char *opath, *ppath, *p, *nh;
|
char *opath, *ppath, *p, *nh;
|
||||||
size_t len;
|
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
if (!path || *path != '~')
|
if (!path || *path != '~')
|
||||||
@ -217,9 +216,7 @@ static char * expand_home(const char *home, const char *path)
|
|||||||
return xstrdup(home);
|
return xstrdup(home);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(ppath) + strlen(home) + 1;
|
xasprintf(&nh, "%s%s", home, ppath);
|
||||||
nh = xmalloc(len);
|
|
||||||
snprintf(nh, len, "%s%s", home, ppath);
|
|
||||||
free(opath);
|
free(opath);
|
||||||
return nh;
|
return nh;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user