wayland-server: reduce use of magic numbers

Make it clear what the significance of '5' and '113' actually is.
Also drop an unneeded function argument.
drop use of strerror()

It isn't thread-safe. Use the %m conversion specifier instead,
like the rest of the code already does.
wayland-server: fix fd leak on error path

And restructure get_socket_lock() so it's clearer that it's
allocating a new file descriptor.

Uncovered by an upcoming test.
wayland-server: fix socket ownership race condition

Always unlink() the lock file before closing the file
descriptor for it. Otherwise, there is a race like this:

Process A closes fd, releasing the lock
Process B opens the same file, taking the lock
Process A unlinks the lock file
Process C opens the same file, which now no longer exists,
and takes the lock on the newly created lock file

Process B and C both 'own' the same display socket.

unlink()ing while holding the lock is effectively a better
way to release the lock atomically.
wayland-server: add more logging of errors
wayland-server: reject socket paths longer than 108 bytes

Attempting to write anything longer into the embedded char
array would create a non-null-terminated string, and all
later reads would run off the end into invalid memory.

This is a hard limitation of AF_LOCAL/AF_UNIX sockets.
wayland-client: reject socket paths longer than 108 bytes

Attempting to write anything longer into the embedded char
array would create a non-null-terminated string, and all
later reads would run off the end into invalid memory.

This is a hard limitation of AF_LOCAL/AF_UNIX sockets.
tests: sort list of tests
tests: fix make check for out-of-tree builds

It was failing with missing include files.

While here, destroy the ugly "../src/..." include
paths used in the tests that was just hacking around
this problem in the Makefile:

sed -i s/..\\/src\\/// tests/*.c
tests: test that path names longer than 108 bytes are rejected

These would either overflow the struct sockaddr_un, or
be truncated and leave a non-null-terminated string.
protocol: Add explicit nullable types

Most of the time it does not make sense to pass a NULL object, string, or array
to a protocol request. This commit adds an explicit “allow-null” attribute
to mark the request arguments where NULL makes sense.

Passing a NULL object, string, or array to a protocol request which is not
marked as allow-null is now an error. An implementation will never receive
a NULL value for these arguments from a client.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
protocol: Explicitly mark requests which allow null arguments

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
protocol: Add a couple of missing allow-null annotations

wl_data_device.set_selection() allows NULL to withdraw the previously set
selection and wl_surface.attach() allows a NULL buffer to hide the surface.
wayland-cursor: Add error handling for shm_pool_create()
scanner: Plug memory leak in end_element()
server: Don't crash for wl_seat_set_touch(seat, NULL)
shm: Plug leak in shm_create_pool()
protocol: Add missing allow-null to data_device.enter data_offer field

Fixes bug 51889.
doc: fix some typos in documentation
Fixup source comment in wayland-util.h and fix typo in TODO