| 229 | } |
| 230 | |
| 231 | static void serve_cache(const char *socket_path, int debug) |
| 232 | { |
| 233 | struct unix_stream_listen_opts opts = UNIX_STREAM_LISTEN_OPTS_INIT; |
| 234 | int fd; |
| 235 | |
| 236 | fd = unix_stream_listen(socket_path, &opts); |
| 237 | if (fd < 0) |
| 238 | die_errno("unable to bind to '%s'", socket_path); |
| 239 | |
| 240 | printf("ok\n"); |
| 241 | fclose(stdout); |
| 242 | if (!debug) { |
| 243 | if (!freopen("/dev/null", "w", stderr)) |
| 244 | die_errno("unable to point stderr to /dev/null"); |
| 245 | } |
| 246 | |
| 247 | while (serve_cache_loop(fd)) |
| 248 | ; /* nothing */ |
| 249 | |
| 250 | close(fd); |
| 251 | } |
| 252 | |
| 253 | static const char permissions_advice[] = N_( |
| 254 | "The permissions on your socket directory are too loose; other\n" |
no test coverage detected