DesktopMessage: avoid a TOCTOU condition

This commit is contained in:
Pierre Pronchery 2024-02-28 03:01:45 +01:00
parent aac2af926c
commit 57226cb4b2

View File

@ -246,9 +246,6 @@ int desktop_message_send(char const * destination, uint32_t value1,
g_get_tmp_dir(), gdk_get_display(), destination);
addr.sun_len = sizeof(addr) - sizeof(addr.sun_path)
+ strlen(addr.sun_path) + 1;
if(access(addr.sun_path, W_OK) == 0)
return -error_set_code(1, "%s: %s", addr.sun_path,
strerror(errno));
if((fd = socket(addr.sun_family, SOCK_STREAM, 0)) < 0)
return -error_set_code(1, "%s: %s: %s", "socket", addr.sun_path,
strerror(errno));