]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_quota: fix input of a projectid which starts whith a digit
authorLeo Baltus <leo.baltus@tech.omroep.nl>
Fri, 2 Jan 2009 18:23:58 +0000 (19:23 +0100)
committerChristoph Hellwig <hch@brick.lst.de>
Fri, 2 Jan 2009 18:23:58 +0000 (19:23 +0100)
xfs_quota -x -c "project -s 123foo" would result in a lookup for directories
belonging to project 123

Reviewed-by: Christoph Hellwig <hch@lst.de>
libxcmd/input.c

index 4691f0213dbde1134cf4891ce9e2d91a58c214f7..7b04f6c231be7dbaec5958cc06fd5f589dfb4c21 100644 (file)
@@ -339,8 +339,12 @@ prid_from_string(
        prid_t          prid;
        char            *sp;
 
+       /*
+        * Allow either a full numeric or a valid projectname, even
+        * if it starts with a digit.
+        */
        prid = (prid_t)strtoul(project, &sp, 10);
-       if (sp != project)
+       if (*project != '\0' && *sp == '\0')
                return prid;
        prj = getprnam(project);
        if (prj)