Differences From
Artifact [f722b7a517]:
1 1 /* [ʞ] nkvd.c - XDG directory enforcer
2 2 * ~ lexi hale <lexi@hale.su>
3 - * © EUPL v1.2
3 + * 🄯 GNU AGPL v3
4 4 * $ cc -fPIC -pie -shared nkvd.c -Wl,-E -onkvd -ldl
5 5 * [-D_NO_GNU [-D_LIBC=…]] [-D_CONF_HOME=…]
6 6 * $ export LD_PRELOAD=nkvd.so <dissident>
7 7 *
8 8 * ! NOTE: for unknown reasons, nkvd currently only works
9 9 * when built without optimizations. it's probably that
10 10 * wrecker Trotsky's fault. i'm working on it.
................................................................................
167 167 static const char* redir_prefix;
168 168 static const char* redir_to;
169 169 static size_t redir_len;
170 170 static const char* hq;
171 171 static size_t hq_len;
172 172
173 173 static void
174 -configdirs() {
174 +configdirs(void) {
175 175 const char* nkvd = getenv("nkvd_gulag");
176 176 if (nkvd != NULL) redir_to = nkvd, redir_len = strlen(nkvd);
177 177
178 178 const char* xdg = getenv("XDG_CONFIG_HOME");
179 179 if (xdg != NULL) redir_to = xdg, redir_len = strlen(xdg);
180 180
181 181 const char* home = getenv("HOME");
................................................................................
290 290 if(strncmp(base,p,end-p) == 0) return (mode == blacklist);
291 291
292 292 if (*end == 0) break;
293 293 else p = end + 1;
294 294 }
295 295
296 296 # ifdef _NO_GNU
297 - free(name);
297 + free(name); }
298 298 # endif
299 299 return (mode == whitelist);
300 -# ifdef _NO_GNU
301 - }
302 -# endif
303 300 }
304 301
305 302 #pragma GCC push_options
306 303 #pragma GCC optimize ("O0")
307 304
308 305 #define STAT_PARAMS const char* volatile path, struct stat* volatile statbuf
309 306 #define XSTAT_PARAMS int volatile ver, const char* volatile path, struct stat* volatile statbuf