diff --git a/builtin-rm.c b/builtin-rm.c
index 8af3d7eb48e70dc9a640c2e96a058903fb9fddd8..33d04bd015e43965a1bc44bb281908298f152f6c 100644 (file)
--- a/builtin-rm.c
+++ b/builtin-rm.c
ret = unlink(name);
if (!ret && (slash = strrchr(name, '/'))) {
- char *n = strdup(name);
+ char *n = xstrdup(name);
do {
n[slash - name] = 0;
name = n;
git_config(git_default_config);
- newfd = hold_lock_file_for_update(&lock_file, get_index_file());
- if (newfd < 0)
- die("unable to create new index file");
+ newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1);
if (read_cache() < 0)
die("index file corrupt");