Changeset 2488 for neercs/trunk/src/attach.c
- Timestamp:
- Jun 25, 2008, 12:33:40 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/attach.c
r2483 r2488 14 14 #include "neercs.h" 15 15 16 static char * build_socket_path(char *socket_dir )16 static char * build_socket_path(char *socket_dir, char *session_name) 17 17 { 18 18 char *path, *dir; … … 26 26 dir = "/tmp"; 27 27 if(path) 28 snprintf(path, PATH_MAX+1, "%s/neercs.% d.sock", dir, getpid());28 snprintf(path, PATH_MAX+1, "%s/neercs.%s.sock", dir, session_name); 29 29 return path; 30 30 } … … 46 46 47 47 myaddr.sun_family = AF_UNIX; 48 screen_list->socket_path = build_socket_path(screen_list->socket_path );48 screen_list->socket_path = build_socket_path(screen_list->socket_path, screen_list->session_name); 49 49 strncpy(myaddr.sun_path, screen_list->socket_path, sizeof(myaddr.sun_path) - 1); 50 50 unlink(myaddr.sun_path); … … 159 159 } 160 160 161 char ** list_sockets(char *socket_dir )161 char ** list_sockets(char *socket_dir, char *session_name) 162 162 { 163 163 char *pattern, *dir; … … 179 179 return globbuf.gl_pathv; 180 180 181 snprintf(pattern, PATH_MAX, "%s/neercs.*.sock", dir); 181 if(session_name && strlen(session_name)+strlen(dir)+13<PATH_MAX) 182 sprintf(pattern, "%s/neercs.%s.sock", dir, session_name); 183 else 184 snprintf(pattern, PATH_MAX, "%s/neercs.*.sock", dir); 182 185 pattern[PATH_MAX] = '\0'; 183 186
Note: See TracChangeset
for help on using the changeset viewer.