@matheusbsbs / matheus-bagliano / commits / 6e6db39afc
Fork 0

fix up strtoul_ui error handling

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>

Andy Whitcroft committed Apr 19, 2007 at 03:08 UTC 6e6db39afc305e1205a4d2dcf34680bfa80bfc24
2 files changed +2 -2
builtin-update-index.c
+1 -1
@@ -551,7 +551,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
551 if (i+3 >= argc)
552 die("git-update-index: --cacheinfo <mode> <sha1> <path>");
553
554 - if ((strtoul_ui(argv[i+1], 8, &mode) != 1) ||
554 + if (strtoul_ui(argv[i+1], 8, &mode) ||
555 get_sha1_hex(argv[i+2], sha1) ||
556 add_cacheinfo(mode, sha1, argv[i+3], 0))
557 die("git-update-index: --cacheinfo"
convert-objects.c
+1 -1
@@ -88,7 +88,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
88 unsigned int mode;
89 char *slash, *origpath;
90
91 - if (!path || strtoul_ui(buffer, 8, &mode) != 1)
91 + if (!path || strtoul_ui(buffer, 8, &mode))
92 die("bad tree conversion");
93 mode = convert_mode(mode);
94 path++;