mirror of
https://github.com/swaywm/sway.git
synced 2026-05-05 06:46:49 -04:00
20 lines
416 B
C
20 lines
416 B
C
#define _POSIX_C_SOURCE 200809L
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
char *init_dbus_sni_host(const char *prefix) {
|
|
char *name = NULL;
|
|
|
|
name = calloc(sizeof(char), 256);
|
|
if (name == NULL) {
|
|
fprintf(stderr, "Could not allocate SNI host name\n");
|
|
return NULL;
|
|
}
|
|
|
|
pid_t pid = getpid();
|
|
snprintf(name, sizeof(char) * 256, "%s-%d", prefix, pid);
|
|
return name;
|
|
}
|
|
|