xwayland: Improve error checking for strtol call
authorBryce Harrington <bryce@osg.samsung.com>
Thu, 4 Aug 2016 00:40:49 +0000 (17:40 -0700)
committerBryce Harrington <bryce@osg.samsung.com>
Sun, 7 Aug 2016 01:19:12 +0000 (18:19 -0700)
commit139fcabe7cdb1f2296bf02ef917aaab84e00cd4e
tree7ec6ad93ebcf4b83432aeccb0e9abd281c24c96f
parent913d7c15f79da33aa97100286df5d8f88731e252
xwayland: Improve error checking for strtol call

This updates the error checking for the strtol() call in xwayland's
create_lockfile to match other cases.  C.f. cbc05378 and other recent
patches.

A notable difference here is that the existing error checking was
verifying that exactly 10 digits were being read from the lock file,
but the fact that it's 10 digits is just an implementation detail for
how we're writing it.  The pid could be a shorter number of digits, and
would just be space-padded on the left.

This change allows the file to contain any number of digits, but it
can't be blank, all of the digits must be numeric, and the resulting
number must be within the accepted range.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
xwayland/launcher.c