summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-02 21:27:40 -0500
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-02 21:27:40 -0500
commit2719471cb97c721e929c98c6bad40a381269295e (patch)
tree81b2e1e790faed8881114d3922c2a2ed8fdcf6f3 /util.c
parenteb626bd8ee3fddae050dbf9babfbea19961a36f2 (diff)
downloadprism-2719471cb97c721e929c98c6bad40a381269295e.tar.gz
prism-2719471cb97c721e929c98c6bad40a381269295e.zip
Files can now be queued for commit
Diffstat (limited to 'util.c')
-rw-r--r--util.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/util.c b/util.c
index 1c663ae..cd4b838 100644
--- a/util.c
+++ b/util.c
@@ -13,22 +13,19 @@
char *alloc_and_combine_paths(char *p1, char *p2)
{
int l1, l2;
-char *ret, *two;
+char *ret;
if(p1 == NULL || p2 == NULL) return NULL;
l1 = strlen(p1); l2 = strlen(p2);
- ret = (char *)malloc((l1+l2+2)*sizeof(char));
+ ret = (char *)malloc((l1+l2+strlen(DIR_SEP))*sizeof(char));
if(ret == NULL) return ret;
ret[0] = '\0';
strcat(ret, p1);
- two = ret + l1;
- two[0] = DIR_SEP;
- two[1] = '\0';
- two = NULL;
+ strcat(ret, DIR_SEP);
strcat(ret, p2);
return ret;
-} \ No newline at end of file
+}