X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libi3%2Fresolve_tilde.c;h=6dbf132fa7605d59e3c7f96c4ce7ae2c57e0e51f;hb=24a8eac1343ad3fd08221117e597b6062bacef17;hp=26cbabe5f1679cd38ff4f7ac88f220cca2fb7c26;hpb=79e7e699393507ff9d9a33dbb361b26d10d89d85;p=i3%2Fi3 diff --git a/libi3/resolve_tilde.c b/libi3/resolve_tilde.c index 26cbabe5..6dbf132f 100644 --- a/libi3/resolve_tilde.c +++ b/libi3/resolve_tilde.c @@ -5,8 +5,8 @@ * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * */ - #include "libi3.h" + #include #include #include @@ -34,10 +34,11 @@ char *resolve_tilde(const char *path) { err(EXIT_FAILURE, "glob() failed"); } else { head = globbuf.gl_pathv[0]; - result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1); - strncpy(result, head, strlen(head)); - if (tail) - strncat(result, tail, strlen(tail)); + result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1, 1); + strcpy(result, head); + if (tail) { + strcat(result, tail); + } } globfree(&globbuf);