Hi, On 14 November 2016 at 13:05, Pekka Paalanen <[email protected]> wrote: > Patch 139fcabe7cdb1f2296bf02ef917aaab84e00cd4e "xwayland: Improve error > checking for strtol call" caused a regression in the X11 unix socket > lock file parsing. Before that patch, only the first 10 characters were > considered for parsing. After the patch, the newline as the 11th > character caused strtol() to stop parsing at the 10th character which > was then considered an error as not the whole input was consumed. > > The effect of the regression was that no X11 lock files were ever deemed > stale, hence stale lock files were never removed. Up till now, I have > accumulated 37 lock files, and Weston complaining for each of them on > every start it cannot parse them. > > Fix this by terminating the string at the expected newline character. > > Also, it looks like 'pid' was being used uninitialized, risking strtol() > reading past the end of the array. This patch fixes that too.
That all sounds pretty great. For bonus points, it's also broken in that it tries to snprintf(pid, 11, "%10d\n"), where the size includes the trailing NULL. So it'll just print %10d\0. Same as GNOME Shell at least. I'll send a separate one, but this one is tested and pushed, and I've re-enabled XWayland in my local test build: To ssh://git.freedesktop.org/git/wayland/weston c027153..61beda6 push -> master Cheers, Daniel > Signed-off-by: Pekka Paalanen <[email protected]> > --- > xwayland/launcher.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/xwayland/launcher.c b/xwayland/launcher.c > index dcc4b97..97d7c6e 100644 > --- a/xwayland/launcher.c > +++ b/xwayland/launcher.c > @@ -166,6 +166,9 @@ create_lockfile(int display, char *lockfile, size_t lsize) > return -1; > } > > + /* Trim the newline, ensure terminated string. */ > + pid[10] = '\0'; > + > if (!safe_strtoint(pid, &other)) { > weston_log("can't parse lock file %s\n", > lockfile); > -- > 2.7.3 > > _______________________________________________ > wayland-devel mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/wayland-devel
