diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-04-11 16:52:10 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-04-15 12:21:45 +0200 |
commit | 947fb5adf8af450507c978abf1c7ec9f051e5842 (patch) | |
tree | af790669292308b56baf188611ac430012037cba /common/globalvar.c | |
parent | 48b205e32342fc8a2648b2bd3f1f6d9a7d74e6cb (diff) | |
download | barebox-947fb5adf8af450507c978abf1c7ec9f051e5842.tar.gz barebox-947fb5adf8af450507c978abf1c7ec9f051e5842.tar.xz |
string: Fix (v)asprintf prototypes
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/globalvar.c')
-rw-r--r-- | common/globalvar.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/globalvar.c b/common/globalvar.c index 9a793ac4a9..d5dd461963 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -42,7 +42,7 @@ static int nv_save(const char *name, const char *val) if (ret) return ret; - fname = asprintf("/env/nv/%s", name); + fname = basprintf("/env/nv/%s", name); fd = open(fname, O_CREAT | O_WRONLY | O_TRUNC); @@ -135,7 +135,7 @@ int nvvar_remove(const char *name) if (!p) return -ENOENT; - fname = asprintf("/env/nv/%s", p->name); + fname = basprintf("/env/nv/%s", p->name); unlink(fname); free(fname); @@ -217,7 +217,8 @@ char *globalvar_get_match(const char *match, const char *separator) if (!strncmp(match, param->name, strlen(match))) { const char *p = dev_get_param(&global_device, param->name); if (val) { - char *new = asprintf("%s%s%s", val, separator, p); + char *new = basprintf("%s%s%s", val, + separator, p); free(val); val = new; } else { |