aboutsummaryrefslogtreecommitdiffstats
path: root/tests/socket-test.c
Commit message (Collapse)AuthorAgeFilesLines
* Check that XDG base directories paths are absoluteAntonin Décimo2022-06-091-1/+1
| | | | | | | | | | | | | | | | | | | The [spec][1] reads: > All paths set in these environment variables must be absolute. If an > implementation encounters a relative path in any of these variables it should > consider the path invalid and ignore it. and > If $XDG_DATA_HOME is either not set or empty, a default equal to > $HOME/.local/share should be used. Testing that the path is absolute also entails that is is non-empty. [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
* tests: Overly elaborate compiler warning workaroundDaniel Stone2018-08-291-1/+6
| | | | | | | | | | | Clang will rightly point out that example_sockaddr_un in socket-test will get discarded from the compilation unit as it is completely unused. Put in a couple of lines which of no value other than stopping Clang from complaining. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* client: Allow absolute paths in WAYLAND_DISPLAYMatt Hoosier2017-12-111-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support system compositor instances, it is necessary to allow clients' wl_display_connect() to find the compositor's listening socket somewhere outside of XDG_RUNTIME_DIR. For a full account, see the discussion beginning here: https://lists.freedesktop.org/archives/wayland-devel/2017-November/035664.html This change adjusts the client-side connection logic so that, if WAYLAND_DISPLAY is formatted as an absolute pathname, the socket connection attempt is made to just $WAYLAND_DISPLAY rather than usual user-private location $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY. This change is based on Davide Bettio's submission of the same concept at: https://lists.freedesktop.org/archives/wayland-devel/2015-August/023838.html. v4 changes: * Improved internal comments and some boundary-condition error checks in test case. * Refer to compositor as "Wayland server" rather than "Wayland display" in wl_display_connect() doxygen comments. * Remove redundant descriptions of parameter-interpretation mechanics from wl_display_connect() manpage. Reworked things to make it clear that 'name' and $WAYLAND_DISLAY are each capable of encoding absolute server socket paths. * Remove callout to reference implementation behavior in protocol documented. In its place there is now a simple statement that implementations can optionally support absolute socket paths. v3 changes: * Added test case. * Clarified documentation to note that 'name' parameter to wl_display_connect() can also be an absolute path. v2 changes: * Added backward incompatibility note to wl_display_connect() manpage. * Rephased wl_display_connect() manpage changes to precisely match actual changed behavior. * Added mention of new absolute path behavior in wl_display_connect() doxygen comments. * Mentioned new absolute path interpretation of WAYLAND_DISPLAY in protocol documentation. Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com> Acked-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* socket-test: Refactor if check into the assertBryce Harrington2016-01-131-2/+1
| | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* socket-test: Fix some comment typosBryce Harrington2016-01-131-5/+7
| | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* socket-test: Fix style on multi-line commentBryce Harrington2015-06-121-2/+3
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-121-16/+19
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: add tests for bug in adding socketMarek Chalupa2014-08-071-1/+89
| | | | | | | | | | | | | | | Last set of commits introduced a bug. When adding of socket with a particular name fails, then the socket and its lockfile are deleted regardless who created the socket. /* OK */ wl_display_add_socket(display, "wayland-0"); /* this call fails and will delete the original socket */ wl_display_add_socket(display, "wayland-0"); Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: Quiet warningKristian Høgsberg2012-08-291-1/+2
|
* socket-test: don't try to be clever, fail if no XDG_RUNTIME_DIR is setPhilipp Brüschweiler2012-08-141-11/+10
| | | | | | | | Not only setenv(), also putenv() allocates memory on my system (glibc 2.16.0). Just fail with a clear message if XDG_RUNTIME_DIR is not set. https://bugs.freedesktop.org/show_bug.cgi?id=52618
* tests: test that path names longer than 108 bytes are rejectedDylan Noblesmith2012-06-301-0/+82
These would either overflow the struct sockaddr_un, or be truncated and leave a non-null-terminated string.