From 7647b17f1d7a98362f8bdbe48b30d94ed655229c Mon Sep 17 00:00:00 2001 From: "Luiz Fernando N. Capitulino" Date: Tue, 14 Aug 2007 16:45:58 -0300 Subject: Use xmkstemp() instead of mkstemp() xmkstemp() performs error checking and prints a standard error message when an error occur. Signed-off-by: Luiz Fernando N. Capitulino Signed-off-by: Junio C Hamano --- unpack-file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'unpack-file.c') diff --git a/unpack-file.c b/unpack-file.c index 25c56b374a..65c66eb0bf 100644 --- a/unpack-file.c +++ b/unpack-file.c @@ -14,9 +14,7 @@ static char *create_temp_file(unsigned char *sha1) die("unable to read blob object %s", sha1_to_hex(sha1)); strcpy(path, ".merge_file_XXXXXX"); - fd = mkstemp(path); - if (fd < 0) - die("unable to create temp-file"); + fd = xmkstemp(path); if (write_in_full(fd, buf, size) != size) die("unable to write temp-file"); close(fd); -- cgit v1.2.3 From ef90d6d4208a5130185b04f06e5f90a5f9959fe3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 14 May 2008 18:46:53 +0100 Subject: Provide git_config with a callback-data parameter git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- unpack-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unpack-file.c') diff --git a/unpack-file.c b/unpack-file.c index 65c66eb0bf..bcdc8bbb3b 100644 --- a/unpack-file.c +++ b/unpack-file.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) die("Not a valid object name %s", argv[1]); setup_git_directory(); - git_config(git_default_config); + git_config(git_default_config, NULL); puts(create_temp_file(sha1)); return 0; -- cgit v1.2.3 From 2fb3f6db96492b680899f9e40f434eeb4c778a84 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 18 Jan 2009 13:00:12 +0100 Subject: Add calls to git_extract_argv0_path() in programs that call git_config_* Programs that use git_config need to find the global configuration. When runtime prefix computation is enabled, this requires that git_extract_argv0_path() is called early in the program's main(). This commit adds the necessary calls. Signed-off-by: Steffen Prohaska Acked-by: Johannes Sixt Signed-off-by: Junio C Hamano --- unpack-file.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'unpack-file.c') diff --git a/unpack-file.c b/unpack-file.c index bcdc8bbb3b..6dd8ad02fb 100644 --- a/unpack-file.c +++ b/unpack-file.c @@ -1,5 +1,6 @@ #include "cache.h" #include "blob.h" +#include "exec_cmd.h" static char *create_temp_file(unsigned char *sha1) { @@ -25,6 +26,8 @@ int main(int argc, char **argv) { unsigned char sha1[20]; + git_extract_argv0_path(argv[0]); + if (argc != 2) usage("git-unpack-file "); if (get_sha1(argv[1], sha1)) -- cgit v1.2.3 From 34263de0265a484bf44058819a363bb1e627c0ce Mon Sep 17 00:00:00 2001 From: Alexander Potashev Date: Sun, 4 Jan 2009 21:39:27 +0300 Subject: Replace deprecated dashed git commands in usage Signed-off-by: Alexander Potashev Signed-off-by: Junio C Hamano --- unpack-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unpack-file.c') diff --git a/unpack-file.c b/unpack-file.c index 6dd8ad02fb..75cd2f1a6a 100644 --- a/unpack-file.c +++ b/unpack-file.c @@ -29,7 +29,7 @@ int main(int argc, char **argv) git_extract_argv0_path(argv[0]); if (argc != 2) - usage("git-unpack-file "); + usage("git unpack-file "); if (get_sha1(argv[1], sha1)) die("Not a valid object name %s", argv[1]); -- cgit v1.2.3 From 0721c314a5c8fddc877140ab5a333c42c62f780d Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 27 Jun 2009 17:58:47 +0200 Subject: Use die_errno() instead of die() when checking syscalls Lots of die() calls did not actually report the kind of error, which can leave the user confused as to the real problem. Use die_errno() where we check a system/library call that sets errno on failure, or one of the following that wrap such calls: Function Passes on error from -------- -------------------- odb_pack_keep open read_ancestry fopen read_in_full xread strbuf_read xread strbuf_read_file open or strbuf_read_file strbuf_readlink readlink write_in_full xwrite Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- unpack-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unpack-file.c') diff --git a/unpack-file.c b/unpack-file.c index 75cd2f1a6a..ac9cbf7cd8 100644 --- a/unpack-file.c +++ b/unpack-file.c @@ -17,7 +17,7 @@ static char *create_temp_file(unsigned char *sha1) strcpy(path, ".merge_file_XXXXXX"); fd = xmkstemp(path); if (write_in_full(fd, buf, size) != size) - die("unable to write temp-file"); + die_errno("unable to write temp-file"); close(fd); return path; } -- cgit v1.2.3