[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools/xenstore: switch get_optval_int() to get_optval_uint()



commit 561687f6bc3533e663f6f953a7d9cde5c0a130da
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue May 30 10:24:23 2023 +0200
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Wed Jun 7 12:10:31 2023 +0100

    tools/xenstore: switch get_optval_int() to get_optval_uint()
    
    Let get_optval_int() return an unsigned value and rename it
    accordingly.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index dd00f74cb6..0a350dd6f8 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2706,13 +2706,13 @@ int dom0_domid = 0;
 int dom0_event = 0;
 int priv_domid = 0;
 
-static int get_optval_int(const char *arg)
+static unsigned int get_optval_uint(const char *arg)
 {
        char *end;
-       long val;
+       unsigned long val;
 
-       val = strtol(arg, &end, 10);
-       if (!*arg || *end || val < 0 || val > INT_MAX)
+       val = strtoul(arg, &end, 10);
+       if (!*arg || *end || val > INT_MAX)
                barf("invalid parameter value \"%s\"\n", arg);
 
        return val;
@@ -2732,7 +2732,7 @@ static void set_timeout(const char *arg)
 
        if (!eq)
                barf("quotas must be specified via <what>=<seconds>\n");
-       val = get_optval_int(eq + 1);
+       val = get_optval_uint(eq + 1);
        if (what_matches(arg, "watch-event"))
                timeout_watch_event_msec = val * 1000;
        else
@@ -2746,7 +2746,7 @@ static void set_quota(const char *arg, bool soft)
 
        if (!eq)
                barf("quotas must be specified via <what>=<nb>\n");
-       val = get_optval_int(eq + 1);
+       val = get_optval_uint(eq + 1);
        if (what_matches(arg, "outstanding") && !soft)
                quota_req_outstanding = val;
        else if (what_matches(arg, "transaction-nodes") && !soft)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.