Code

init, clone: support --separate-git-dir for .git file
[git.git] / wrapper.c
index 55b074ec46b0a222b03f8bea42f4d5cdd9811293..28290002b9f6434d716a39612f3afc9958c292af 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -53,7 +53,7 @@ void *xmalloc(size_t size)
 void *xmallocz(size_t size)
 {
        void *ret;
-       if (size + 1 < size)
+       if (unsigned_add_overflows(size, 1))
                die("Data too large to fit into virtual memory space.");
        ret = xmalloc(size + 1);
        ((char*)ret)[size] = 0;
@@ -209,7 +209,7 @@ int xmkstemp(char *template)
                if (!template[0])
                        template = origtemplate;
 
-               nonrelative_template = make_nonrelative_path(template);
+               nonrelative_template = absolute_path(template);
                errno = saved_errno;
                die_errno("Unable to create temporary file '%s'",
                        nonrelative_template);
@@ -344,7 +344,7 @@ int xmkstemp_mode(char *template, int mode)
                if (!template[0])
                        template = origtemplate;
 
-               nonrelative_template = make_nonrelative_path(template);
+               nonrelative_template = absolute_path(template);
                errno = saved_errno;
                die_errno("Unable to create temporary file '%s'",
                        nonrelative_template);