Code

avoid NULL dereference on failed malloc
[git.git] / builtin-clone.c
index d068b7e0d89399ac54c2cf56f128d8884e20b665..5c46496a43a8fe2f91b395563b266e79a8b94429 100644 (file)
@@ -252,7 +252,8 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
                }
 
                if (unlink(dest->buf) && errno != ENOENT)
-                       die("failed to unlink %s", dest->buf);
+                       die("failed to unlink %s: %s",
+                           dest->buf, strerror(errno));
                if (!option_no_hardlinks) {
                        if (!link(src->buf, dest->buf))
                                continue;
@@ -359,7 +360,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
        junk_pid = getpid();
 
-       argc = parse_options(argc, argv, builtin_clone_options,
+       argc = parse_options(argc, argv, prefix, builtin_clone_options,
                             builtin_clone_usage, 0);
 
        if (argc == 0)