aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--socket-sucker.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/socket-sucker.c b/socket-sucker.c
index 0b1ee27..b5fb543 100644
--- a/socket-sucker.c
+++ b/socket-sucker.c
@@ -17,11 +17,16 @@ main (int argc, char * argv[])
bzero((char *)&serv_addr, sizeof(serv_addr));
+ const char * home = getenv("HOME");
+ if (home == NULL) {
+ return -1;
+ }
+
serv_addr.sun_family = AF_UNIX;
- strcpy(serv_addr.sun_path, "/home/ted/.freerdp-socket");
+ snprintf(serv_addr.sun_path, sizeof(serv_addr.sun_path), "%s/%s", home, ".freerdp-socket");
servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
- if ((socket_fd = socket(AF_UNIX, SOCK_STREAM,0)) < 0) {
+ if ((socket_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
return -1;
}