entry.c: use error_errno()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
May 8, 2016 at 16:47 UTC
e1ebb3c25bd42b06fe8f5f886af37dfac8a823a1
1 file changed
+4
-6
entry.c
+4
-6
@@ -168,8 +168,8 @@ static int write_entry(struct cache_entry *ce,
168
ret = symlink(new, path);
169
free(new);
170
if (ret)
171
- return error("unable to create symlink %s (%s)",
172
- path, strerror(errno));
171
+ return error_errno("unable to create symlink %s",
172
+ path);
173
break;
174
}
175
@@ -186,8 +186,7 @@ static int write_entry(struct cache_entry *ce,
186
fd = open_output_fd(path, ce, to_tempfile);
187
if (fd < 0) {
188
free(new);
189
- return error("unable to create file %s (%s)",
190
- path, strerror(errno));
189
+ return error_errno("unable to create file %s", path);
190
}
191
192
wrote = write_in_full(fd, new, size);
@@ -284,8 +283,7 @@ int checkout_entry(struct cache_entry *ce,
283
return error("%s is a directory", path.buf);
284
remove_subtree(&path);
285
} else if (unlink(path.buf))
287
- return error("unable to unlink old '%s' (%s)",
288
- path.buf, strerror(errno));
286
+ return error_errno("unable to unlink old '%s'", path.buf);
287
} else if (state->not_new)
288
return 0;
289