[PATCH 03/14] write_subdirectory(): use convert_ui() for parsing mode
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Mar 17, 2015, 16:00 UTC
- Message-ID
- <1426608016-2978-4-git-send-email-mhagger@alum.mit.edu>
- In-Reply-To
- <1426608016-2978-1-git-send-email-mhagger@alum.mit.edu>
Use convert_ui() instead of strtoul_ui() when parsing tree entries' modes. This tightens up the parsing a bit:
* Leading whitespace is no longer allowed * '+' and '-' are no longer allowed
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> --- contrib/convert-objects/convert-objects.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/convert-objects/convert-objects.c b/contrib/convert-objects/convert-objects.c index f3b57bf..4f484a4 100644 --- a/contrib/convert-objects/convert-objects.c +++ b/contrib/convert-objects/convert-objects.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "numparse.h" #include "blob.h" #include "commit.h" #include "tree.h" @@ -88,7 +89,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)) + if (!path || convert_ui(buffer, 8, &mode)) die("bad tree conversion"); mode = convert_mode(mode); path++;
-- 2.1.4