Updated to Git v1.8.1
[msysgit.git] / src / rt / patches / 0005-Temporary-workaround-use-strtol-instead-of-strtoll.patch
bloba3d707a34c072b850e7d0def9533a24606c0e931
1 From e0e110e8062b643b02ef16c8ee4a503161a9546d Mon Sep 17 00:00:00 2001
2 From: Alexander Gavrilov <angavrilov@gmail.com>
3 Date: Wed, 16 Jul 2008 20:48:53 +0400
4 Subject: [PATCH] Temporary workaround: use strtoul instead of strtoll.
6 Also fixes a bug in negative pid handling (the 'av' part).
7 ---
8 source/winsup/utils/kill.cc | 20 +++++++++++++++++---
9 1 files changed, 17 insertions(+), 3 deletions(-)
11 diff --git a/source/winsup/utils/kill.cc b/source/winsup/utils/kill.cc
12 index e21646f..3f4934c 100644
13 --- a/source/winsup/utils/kill.cc
14 +++ b/source/winsup/utils/kill.cc
15 @@ -179,6 +179,17 @@ forcekill (int pid, int sig, int wait)
16 CloseHandle (h);
19 +static long long
20 +strtoll_compat(char *str, char **p, int base)
22 + if (*str == '-')
23 + return -(long long) strtoul(str+1, p, base);
24 + else if (*str == '+')
25 + return strtoul(str+1, p, base);
26 + else
27 + return strtoul(str, p, base);
30 int
31 main (int argc, char **argv)
33 @@ -241,9 +252,12 @@ main (int argc, char **argv)
34 case '?':
35 if (gotasig)
37 - pid = strtoll (argv[optind], &p, 10);
38 + pid = strtoll_compat (*av, &p, 10);
39 if (pid < 0)
40 - goto out;
41 + {
42 + optind = av - argv;
43 + goto out;
44 + }
45 usage ();
47 optreset = 1;
48 @@ -264,7 +278,7 @@ out:
49 while (*argv != NULL)
51 if (!pid)
52 - pid = strtoll (*argv, &p, 10);
53 + pid = strtoll_compat (*argv, &p, 10);
54 if (*p != '\0'
55 || (!force && (pid < LONG_MIN || pid > LONG_MAX))
56 || (force && (pid <= 0 || pid > ULONG_MAX)))
57 --
58 1.5.6.3.1089.g3c8b0