aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-21 14:30:41 -0500
committerTed Gould <ted@gould.cx>2012-08-21 14:30:41 -0500
commit7c3a571168e3bef61b689524937af89e7efb07b0 (patch)
tree226e194c84b3ada0b9ff44272daf1381ee6dcf78
parent3541e56c2790c309f4f37795109a044e29c0c606 (diff)
downloadlightdm-remote-session-freerdp2-7c3a571168e3bef61b689524937af89e7efb07b0.tar.gz
lightdm-remote-session-freerdp2-7c3a571168e3bef61b689524937af89e7efb07b0.tar.bz2
lightdm-remote-session-freerdp2-7c3a571168e3bef61b689524937af89e7efb07b0.zip
Getting the directory using the home environment variable
-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;
}