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
commit402133a40e196f9acb64b989e3e42039f073ba52 (patch)
tree226e194c84b3ada0b9ff44272daf1381ee6dcf78
parente610f6f207135dd5513a2c3120bf0ae391db2910 (diff)
downloadlightdm-remote-session-x2go-402133a40e196f9acb64b989e3e42039f073ba52.tar.gz
lightdm-remote-session-x2go-402133a40e196f9acb64b989e3e42039f073ba52.tar.bz2
lightdm-remote-session-x2go-402133a40e196f9acb64b989e3e42039f073ba52.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;
}