Skip to content

Commit

Permalink
fix up strtoul_ui error handling
Browse files Browse the repository at this point in the history
Two scanf() calls were converted to strtoul_ui() but the return
values were not updated to match.  scanf() returns the number of
matched "values" which for this usage is 1 on success.  strtoul_ui()
return 0 on success.  Update these call sites to match.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Andy Whitcroft authored and Junio C Hamano committed Apr 19, 2007
1 parent 9f1beb7 commit 6e6db39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion builtin-update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
if (i+3 >= argc)
die("git-update-index: --cacheinfo <mode> <sha1> <path>");

if ((strtoul_ui(argv[i+1], 8, &mode) != 1) ||
if (strtoul_ui(argv[i+1], 8, &mode) ||
get_sha1_hex(argv[i+2], sha1) ||
add_cacheinfo(mode, sha1, argv[i+3], 0))
die("git-update-index: --cacheinfo"
Expand Down
2 changes: 1 addition & 1 deletion convert-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
unsigned int mode;
char *slash, *origpath;

if (!path || strtoul_ui(buffer, 8, &mode) != 1)
if (!path || strtoul_ui(buffer, 8, &mode))
die("bad tree conversion");
mode = convert_mode(mode);
path++;
Expand Down

0 comments on commit 6e6db39

Please sign in to comment.