Replace a chain of stpcpy's with a sprintf
authorPetr Machata <pmachata@redhat.com>
Wed, 6 Nov 2013 10:59:59 +0000 (11:59 +0100)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:23 +0000 (20:38 +0900)
- That's clearer and doesn't require _POSIX_SOURCE defines (that are
  missing anyway)

prototype.c

index a892666..fa52ff3 100644 (file)
@@ -342,9 +342,8 @@ consider_config_dir(struct protolib_cache *cache,
                    const char *path, const char *key)
 {
        size_t len = sizeof ".conf";
-       char slash[2] = {'/'};
        char *buf = alloca(strlen(path) + 1 + strlen(key) + len);
-       strcpy(stpcpy(stpcpy(stpcpy(buf, path), slash), key), ".conf");
+       sprintf(buf, "%s/%s.conf", path, key);
 
        return protolib_cache_file(cache, buf, 0);
 }