View | Details | Raw Unified | Return to bug 147691
Collapse All | Expand All

(-)kdelibs/kinit/wrapper.c.sav (-1 / +3 lines)
Lines 164-170 Link Here
164
     sock_file[strlen(sock_file)-1] = 0;
164
     sock_file[strlen(sock_file)-1] = 0;
165
  
165
  
166
  strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
166
  strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
167
  if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
167
  if( getenv("KDESYSTEMHOSTNAME"))
168
      strncat(sock_file, getenv("KDESYSTEMHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1);
169
  else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
168
  {
170
  {
169
     perror("Warning: Could not determine hostname: ");
171
     perror("Warning: Could not determine hostname: ");
170
     return -1;
172
     return -1;
(-)kdelibs/kinit/lnusertemp.c.sav (-6 / +19 lines)
Lines 39-45 Link Here
39
39
40
int check_tmp_dir(const char *tmp_dir);
40
int check_tmp_dir(const char *tmp_dir);
41
int create_link(const char *file, const char *tmp_dir);
41
int create_link(const char *file, const char *tmp_dir);
42
int build_link(const char *tmp_prefix, const char *kde_prefix);
42
int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname);
43
43
44
int check_tmp_dir(const char *tmp_dir)
44
int check_tmp_dir(const char *tmp_dir)
45
{
45
{
Lines 89-95 Link Here
89
}
89
}
90
90
91
91
92
int build_link(const char *tmp_prefix, const char *kde_prefix)
92
int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname)
93
{
93
{
94
  struct passwd *pw_ent;
94
  struct passwd *pw_ent;
95
  char kde_tmp_dir[PATH_MAX+1];
95
  char kde_tmp_dir[PATH_MAX+1];
Lines 156-165 Link Here
156
  }  
156
  }  
157
157
158
  strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir));
158
  strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir));
159
  if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
159
160
  if( kdehostname )
161
  {
162
      if( getenv("KDESYSTEMHOSTNAME"))
163
          strncat(kde_tmp_dir+strlen(kde_tmp_dir), getenv("KDESYSTEMHOSTNAME"), PATH_MAX - strlen(kde_tmp_dir) - 1);
164
      else
165
          return 0;
166
  }
167
  else
160
  {
168
  {
161
     perror("Aborting. Could not determine hostname: ");
169
     if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
162
     exit(255);
170
     {
171
        perror("Could not determine hostname: ");
172
        return 1;
173
     }
163
  }
174
  }
164
  kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
175
  kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
165
176
Lines 266-272 Link Here
266
    kde_prefix = "/cache-"; 
277
    kde_prefix = "/cache-"; 
267
  }
278
  }
268
279
269
  res = build_link(tmp_prefix, kde_prefix); 
280
  res = build_link(tmp_prefix, kde_prefix, 1); 
281
  if( !build_link(tmp_prefix, kde_prefix, 0))
282
    res = 1;
270
    
283
    
271
  free(tmp_prefix);
284
  free(tmp_prefix);
272
285
(-)kdelibs/kdecore/kstandarddirs.cpp.sav (-1 / +4 lines)
Lines 718-724 Link Here
718
{
718
{
719
   char hostname[256];
719
   char hostname[256];
720
   hostname[0] = 0;
720
   hostname[0] = 0;
721
   gethostname(hostname, 255);
721
   if( getenv("KDESYSTEMHOSTNAME"))
722
       strlcpy(hostname, getenv("KDESYSTEMHOSTNAME"), 255 );
723
   else
724
       gethostname(hostname, 255);
722
   QString dir = QString("%1%2-%3").arg(localkdedir()).arg(type).arg(hostname);
725
   QString dir = QString("%1%2-%3").arg(localkdedir()).arg(type).arg(hostname);
723
   char link[1024];
726
   char link[1024];
724
   link[1023] = 0;
727
   link[1023] = 0;
(-)kdelibs/kdecore/kcrash.cpp.sav (-1 / +3 lines)
Lines 461-467 Link Here
461
     sock_file[strlen(sock_file)-1] = 0;
461
     sock_file[strlen(sock_file)-1] = 0;
462
  
462
  
463
  strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
463
  strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
464
  if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
464
  if( getenv("KDESYSTEMHOSTNAME"))
465
      strncat(sock_file, getenv("KDESYSTEMHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1);
466
  else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
465
  {
467
  {
466
     perror("Warning: Could not determine hostname: ");
468
     perror("Warning: Could not determine hostname: ");
467
     return -1;
469
     return -1;
(-)kdelibs/dcop/dcopserver_shutdown.c.sav (-1 / +3 lines)
Lines 95-101 Link Here
95
  strncat(dcop_file, "/.DCOPserver_", n);
95
  strncat(dcop_file, "/.DCOPserver_", n);
96
  n -= strlen("/.DCOPserver_");
96
  n -= strlen("/.DCOPserver_");
97
97
98
  if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
98
  if (getenv("KDESYSTEMHOSTNAME"))
99
     strncat(dcop_file+strlen(dcop_file), getenv("KDESYSTEMHOSTNAME"), n);
100
  else if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
99
  {
101
  {
100
     perror("Error. Could not determine hostname: ");
102
     perror("Error. Could not determine hostname: ");
101
     dcop_file[0] = '\0';
103
     dcop_file[0] = '\0';
(-)kdelibs/dcop/dcopc.c.sav (-1 / +3 lines)
Lines 684-690 Link Here
684
    }
684
    }
685
685
686
    hostName[0] = '\0';
686
    hostName[0] = '\0';
687
    if (gethostname(hostName, sizeof(hostName)))
687
    if (getenv("KDESYSTEMHOSTNAME"))
688
            strlcpy(hostName, getenv("KDESYSTEMHOSTNAME"),sizeof(hostName)-1);
689
    else if (gethostname(hostName, sizeof(hostName)))
688
	    strcpy(hostName, "localhost");
690
	    strcpy(hostName, "localhost");
689
    else
691
    else
690
	    hostName[sizeof(hostName)-1] = '\0';
692
	    hostName[sizeof(hostName)-1] = '\0';
(-)kdelibs/dcop/dcopclient.cpp.sav (-1 / +3 lines)
Lines 275-281 Link Here
275
    {
275
    {
276
        char hostName[256];
276
        char hostName[256];
277
        hostName[0] = '\0';
277
        hostName[0] = '\0';
278
        if (gethostname(hostName, sizeof(hostName)))
278
        if (getenv("KDESYSTEMHOSTNAME"))
279
            fName += getenv("KDESYSTEMHOSTNAME");
280
        else if (gethostname(hostName, sizeof(hostName)))
279
        {
281
        {
280
            fName += "localhost";
282
            fName += "localhost";
281
        }
283
        }

Return to bug 147691