util  Diff

Differences From Artifact [66bf54f80a]:

To Artifact [eee3f888cb]:


    38     38    *    still remote-working on German time because his
    39     39    *    employers are kind of assholes. i'm aware that's
    40     40    *    not an excuse and i apologize sincerely. if
    41     41    *    anyone wants to submit a MR to tidy up this
    42     42    *    abomination without sacrificing performance, i
    43     43    *    would welcome it gratefully. */
    44     44   
           45  +#define _POSIX_C_SOURCE 200809L
           46  +
    45     47   #include <stdio.h>
    46     48   #include <stdlib.h>
    47     49   #include <sys/types.h>
    48     50   #include <sys/socket.h>
    49     51   #include <sys/un.h>
    50     52   #include <dirent.h>
    51     53   #include <unistd.h>
    52         -#define _POSIX_C_SOURCE 200809L
    53     54   #include <string.h>
    54     55   
    55     56   #define ssz(str) (str), (sizeof str)
    56     57   #define dupl(x) x,x
    57     58   
    58     59   #ifndef _default_qutebrowser_location
    59     60   #	define _default_qutebrowser_location "/usr/bin/qutebrowser"
................................................................................
   107    108   
   108    109   	int sock = socket(AF_UNIX, SOCK_STREAM, 0);
   109    110   	if (connect(sock, (struct sockaddr*)&srv, sizeof srv) != 0)
   110    111   		return start_instance;
   111    112   
   112    113   	const char msg_blank [] = json_msg_start json_msg_end;
   113    114   	const size_t extra = uri != NULL ? strlen(uri) : 0;
   114         -	char msg_start [(sizeof json_msg_start) + extra];
          115  +	char msg_start [(sizeof json_msg_start) + extra + (sizeof json_msg_end) - 1];
   115    116   
   116    117   	const size_t msgsz = sizeof msg_blank + extra - 1;
   117    118   	const char*  msg;
   118    119   	if (uri == NULL) msg = msg_blank; else {
   119    120   		strcpy(msg_start, json_msg_start);
   120    121   		strcpy(msg_start + (sizeof json_msg_start) - 1, uri);
   121    122   		strcpy(msg_start + (sizeof json_msg_start) - 1 + extra, json_msg_end);