summaryrefslogtreecommitdiffstats
path: root/mcop
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-05 21:11:05 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-05 21:11:05 +0000
commit6637c742279c9df570b3bd1d09244f1b0f66ee62 (patch)
tree522e3430dc3b085aad27f9eb6f144977b65a1dd3 /mcop
parent7de042bb5beca4107a444f8c60ef24c9735deb65 (diff)
downloadarts-6637c742279c9df570b3bd1d09244f1b0f66ee62.tar.gz
arts-6637c742279c9df570b3bd1d09244f1b0f66ee62.zip
Compilation repairs
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/arts@1212131 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'mcop')
-rw-r--r--mcop/anyref.h2
-rw-r--r--mcop/asyncstream.h2
-rw-r--r--mcop/buffer.h2
-rw-r--r--mcop/common.h2
-rw-r--r--mcop/connect.h2
-rw-r--r--mcop/connection.h2
-rw-r--r--mcop/datapacket.h2
-rw-r--r--mcop/debug.h2
-rw-r--r--mcop/delayedreturn.h2
-rw-r--r--mcop/dispatcher.h2
-rw-r--r--mcop/dynamicrequest.h2
-rw-r--r--mcop/dynamicskeleton.h2
-rw-r--r--mcop/extensionloader.h2
-rw-r--r--mcop/factory.h2
-rw-r--r--mcop/flowsystem.h2
-rw-r--r--mcop/idlfilereg.h2
-rw-r--r--mcop/ifacerepo_impl.h2
-rw-r--r--mcop/iomanager.h2
-rw-r--r--mcop/loopback.h2
-rw-r--r--mcop/mcopconfig.h2
-rw-r--r--mcop/mcoputils.cc211
-rw-r--r--mcop/mcoputils.h2
-rw-r--r--mcop/md5.h2
-rw-r--r--mcop/md5auth.h2
-rw-r--r--mcop/namedstore.h2
-rw-r--r--mcop/notification.h2
-rw-r--r--mcop/object.h2
-rw-r--r--mcop/objectmanager.h2
-rw-r--r--mcop/pool.h2
-rw-r--r--mcop/reference.h2
-rw-r--r--mcop/referenceclean.h2
-rw-r--r--mcop/socketconnection.h2
-rw-r--r--mcop/startupmanager.h2
-rw-r--r--mcop/tcpconnection.h2
-rw-r--r--mcop/tcpserver.h2
-rw-r--r--mcop/thread.h2
-rw-r--r--mcop/type.h2
-rw-r--r--mcop/unixconnection.h2
-rw-r--r--mcop/unixserver.h2
-rw-r--r--mcop/weakreference.h2
40 files changed, 147 insertions, 142 deletions
diff --git a/mcop/anyref.h b/mcop/anyref.h
index 332c5c7..60e1836 100644
--- a/mcop/anyref.h
+++ b/mcop/anyref.h
@@ -27,7 +27,7 @@
#include <string>
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): AnyRefBase, AnyRef, AnyConstRef
+ * BC - Status (2002-03-08): AnyRefBase, AnyRef, AnyConstRef
*
* These classes will be kept binary compatibile. To change it, adding a new
* representation is necessary. No private d pointer for this reason.
diff --git a/mcop/asyncstream.h b/mcop/asyncstream.h
index 6b31ef9..acd27c4 100644
--- a/mcop/asyncstream.h
+++ b/mcop/asyncstream.h
@@ -28,7 +28,7 @@
#include "datapacket.h"
/*
- * BC - tqStatus (2002-03-08): GenericAsyncStream, AsyncStream,
+ * BC - Status (2002-03-08): GenericAsyncStream, AsyncStream,
* FloatAsyncStream/ByteAsyncStream
*
* These classes are to be treated with extreme care, as they are used in
diff --git a/mcop/buffer.h b/mcop/buffer.h
index 7cfef58..c1cc1b0 100644
--- a/mcop/buffer.h
+++ b/mcop/buffer.h
@@ -27,7 +27,7 @@
#include <vector>
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): Buffer.
+ * BC - Status (2002-03-08): Buffer.
*
* Has to be kept binary compatible. As buffer is speed relevant, currently
* there are no private d ptrs, and the idea is to keep this as possible.
diff --git a/mcop/common.h b/mcop/common.h
index 22783c2..2dbde70 100644
--- a/mcop/common.h
+++ b/mcop/common.h
@@ -36,7 +36,7 @@
#include "connect.h"
/*
- * BC - tqStatus (2002-03-08): Read/WriteObject(Seq)
+ * BC - Status (2002-03-08): Read/WriteObject(Seq)
*
* Will be kept binary compatible by NOT TOUCHING AT ALL. Do not change this.
* (Interaction with generated code).
diff --git a/mcop/connect.h b/mcop/connect.h
index 721b143..aa9065b 100644
--- a/mcop/connect.h
+++ b/mcop/connect.h
@@ -22,7 +22,7 @@
#define MCOP_CONNECT_H
/*
- * BC - tqStatus (2002-03-08): connect / setValue functions
+ * BC - Status (2002-03-08): connect / setValue functions
*
* Will be kept as they are (binary compatible).
*/
diff --git a/mcop/connection.h b/mcop/connection.h
index 34cc08b..c68f80d 100644
--- a/mcop/connection.h
+++ b/mcop/connection.h
@@ -27,7 +27,7 @@
#include "buffer.h"
/*
- * BC - tqStatus (2002-03-08): Connection.
+ * BC - Status (2002-03-08): Connection.
*
* None of these classes is considered part of the public API. However, they
* NEED to be kept binary compatible as the DO interact with generated code.
diff --git a/mcop/datapacket.h b/mcop/datapacket.h
index b68e8de..e62348e 100644
--- a/mcop/datapacket.h
+++ b/mcop/datapacket.h
@@ -27,7 +27,7 @@
#include "buffer.h"
/*
- * BC - tqStatus (2002-03-08): GenericDataChannel, DataPacket types
+ * BC - Status (2002-03-08): GenericDataChannel, DataPacket types
*
* These classes must be kept binary compatible, as the do interact with
* generated code. So you MUST KNOW WHAT YOU ARE DOING, once you start
diff --git a/mcop/debug.h b/mcop/debug.h
index 0999b7b..6ef83e5 100644
--- a/mcop/debug.h
+++ b/mcop/debug.h
@@ -31,7 +31,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): Debug.
+ * BC - Status (2002-03-08): Debug.
*
* Collection class, no instance, no members. Thus binary compatible (will
* be kept).
diff --git a/mcop/delayedreturn.h b/mcop/delayedreturn.h
index 84373c0..290cfc4 100644
--- a/mcop/delayedreturn.h
+++ b/mcop/delayedreturn.h
@@ -26,7 +26,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): DelayedReturn
+ * BC - Status (2002-03-08): DelayedReturn
*
* This class will be kept binary compatible. It has a private d-pointer for
* further extensions.
diff --git a/mcop/dispatcher.h b/mcop/dispatcher.h
index 683cba1..6a2be82 100644
--- a/mcop/dispatcher.h
+++ b/mcop/dispatcher.h
@@ -38,7 +38,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): Dispatcher
+ * BC - Status (2002-03-08): Dispatcher
*
* This is part of the public API (and interacts with generated code) and
* has to be kept binary compatible.
diff --git a/mcop/dynamicrequest.h b/mcop/dynamicrequest.h
index ff98b95..b1316b0 100644
--- a/mcop/dynamicrequest.h
+++ b/mcop/dynamicrequest.h
@@ -31,7 +31,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): DynamicRequest
+ * BC - Status (2002-03-08): DynamicRequest
*
* Has to be kept binary compatible (use d ptr).
*/
diff --git a/mcop/dynamicskeleton.h b/mcop/dynamicskeleton.h
index d68ced7..7fece5b 100644
--- a/mcop/dynamicskeleton.h
+++ b/mcop/dynamicskeleton.h
@@ -28,7 +28,7 @@
#include "object.h"
/*
- * BC - tqStatus (2002-03-08): DynamicSkeletonBase, DynamicSkeleton
+ * BC - Status (2002-03-08): DynamicSkeletonBase, DynamicSkeleton
*
* Will be kept binary compatible (using d ptr).
*/
diff --git a/mcop/extensionloader.h b/mcop/extensionloader.h
index 825b17f..034ecf4 100644
--- a/mcop/extensionloader.h
+++ b/mcop/extensionloader.h
@@ -30,7 +30,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): ExtensionLoader
+ * BC - Status (2002-03-08): ExtensionLoader
*
* None of these classes is considered part of the public API. Do NOT use it
* in your apps. No binary compatibility guaranteed. (Interactions:
diff --git a/mcop/factory.h b/mcop/factory.h
index 47ea466..6adab89 100644
--- a/mcop/factory.h
+++ b/mcop/factory.h
@@ -31,7 +31,7 @@
#include "startupmanager.h"
/*
- * BC - tqStatus (2002-03-08): Factory
+ * BC - Status (2002-03-08): Factory
*
* Will need to remain binary compatible (REGISTER_IMPLEMENTATION), d ptr
* provided for convenience, watch out for interactions with generated
diff --git a/mcop/flowsystem.h b/mcop/flowsystem.h
index 57be7e1..532f1de 100644
--- a/mcop/flowsystem.h
+++ b/mcop/flowsystem.h
@@ -28,7 +28,7 @@
#include "common.h"
/*
- * BC - tqStatus (2002-03-08): ScheduleNode, FlowSystem, FlowSystem_impl,
+ * BC - Status (2002-03-08): ScheduleNode, FlowSystem, FlowSystem_impl,
* RemoteScheduleNode
*
* Heavy interactions with generated and hand-written code, flowsystem binding
diff --git a/mcop/idlfilereg.h b/mcop/idlfilereg.h
index 61c255a..77b5fa6 100644
--- a/mcop/idlfilereg.h
+++ b/mcop/idlfilereg.h
@@ -29,7 +29,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): IDLFileReg
+ * BC - Status (2002-03-08): IDLFileReg
*
* Will be kept binary compatible by NOT TOUCHING AT ALL. Do not change this.
* (Interaction with generated code). Add a new class if you need something
diff --git a/mcop/ifacerepo_impl.h b/mcop/ifacerepo_impl.h
index 1379ec4..ca22516 100644
--- a/mcop/ifacerepo_impl.h
+++ b/mcop/ifacerepo_impl.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): InterfaceRepo_impl
+ * BC - Status (2002-03-08): InterfaceRepo_impl
*
* This is an implementation class, and not kept binary compatible. It's
* only here since the REGISTER_IMPLEMENTATION bootstrapping may not yet
diff --git a/mcop/iomanager.h b/mcop/iomanager.h
index f3afaf7..fc88268 100644
--- a/mcop/iomanager.h
+++ b/mcop/iomanager.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08):
+ * BC - Status (2002-03-08):
* BINARY COMPATIBLE: IONotify, TimeNotify, IOManager
* NO BC FOR: StdIOManager
*
diff --git a/mcop/loopback.h b/mcop/loopback.h
index 214c903..e16d1cd 100644
--- a/mcop/loopback.h
+++ b/mcop/loopback.h
@@ -28,7 +28,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): LoopbackConnection
+ * BC - Status (2002-03-08): LoopbackConnection
*
* Not part of the public API. Do NOT use it in your apps. No binary
* compatibility guaranteed.
diff --git a/mcop/mcopconfig.h b/mcop/mcopconfig.h
index d75adc3..8fb1e10 100644
--- a/mcop/mcopconfig.h
+++ b/mcop/mcopconfig.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): MCOPConfig
+ * BC - Status (2002-03-08): MCOPConfig
*
* Is guaranteed to stay binary compatible. d ptr provided.
*/
diff --git a/mcop/mcoputils.cc b/mcop/mcoputils.cc
index 168f55f..1bfe5df 100644
--- a/mcop/mcoputils.cc
+++ b/mcop/mcoputils.cc
@@ -79,8 +79,8 @@ if ((result == -1) && (errno == ENOENT))
static char *locate_mcop_dir()
{
struct passwd *pw_ent;
- char kde_tmp_dir[PATH_MAX+1];
- char user_tmp_dir[PATH_MAX+1];
+ string kde_tmp_dir;
+ string user_tmp_dir;
int uid = getuid();
const char *home_dir = getenv("HOME");
const char *kde_home = uid ? getenv("KDEHOME") : getenv("KDEROOTHOME");
@@ -96,7 +96,7 @@ static char *locate_mcop_dir()
if (!tmp || !tmp[0])
tmp = "/tmp";
- kde_tmp_dir[0] = 0;
+ kde_tmp_dir = "";
pw_ent = getpwuid(uid);
if (!pw_ent)
@@ -105,12 +105,7 @@ static char *locate_mcop_dir()
return 0;
}
- strncpy(user_tmp_dir, tmp, PATH_MAX );
- user_tmp_dir[ PATH_MAX ] = '\0';
- strncat(user_tmp_dir, "/ksocket-", PATH_MAX - strlen(user_tmp_dir) );
- user_tmp_dir[ PATH_MAX ] = '\0';
- strncat(user_tmp_dir, pw_ent->pw_name, PATH_MAX - strlen(user_tmp_dir));
- user_tmp_dir[ PATH_MAX ] = '\0';
+ user_tmp_dir = string(tmp) + "/ksocket-" + string(pw_ent->pw_name);
if (!kde_home || !kde_home[0])
{
@@ -127,44 +122,37 @@ static char *locate_mcop_dir()
{
arts_fatal("Aborting. $HOME not set!");
}
- if (strlen(home_dir) > (PATH_MAX-100))
- {
- arts_fatal("Aborting. Home directory path too long!");
- }
kde_home++;
- strncpy(kde_tmp_dir, home_dir, PATH_MAX);
- kde_tmp_dir[ PATH_MAX ] = '\0';
+ kde_tmp_dir = string(home_dir);
}
- strncat(kde_tmp_dir, kde_home, PATH_MAX - strlen(kde_tmp_dir));
+ kde_tmp_dir += kde_home;
/** Strip trailing '/' **/
- if ( kde_tmp_dir[strlen(kde_tmp_dir)-1] == '/')
- kde_tmp_dir[strlen(kde_tmp_dir)-1] = 0;
+ if ( kde_tmp_dir[kde_tmp_dir.length()-1] == '/')
+ kde_tmp_dir.resize(kde_tmp_dir.length()-1);
- result = stat(kde_tmp_dir, &stat_buf);
+ result = stat(kde_tmp_dir.c_str(), &stat_buf);
if (result == -1)
{
return 0;
}
- strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir));
- if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
+ kde_tmp_dir += kde_prefix;
{
- arts_fatal("Aborting. Could not determine hostname or hostname too long.");
+ char buf[1024];
+ if (gethostname(buf, sizeof(buf)-1) != 0)
+ {
+ arts_fatal("Aborting. Could not determine hostname or hostname too long.");
+ }
+ buf[sizeof(buf)-1] = '\0';
+ kde_tmp_dir += buf;
}
- kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
- result = lstat(kde_tmp_dir, &stat_buf);
+ result = lstat(kde_tmp_dir.c_str(), &stat_buf);
if ((result == 0) && (S_ISDIR(stat_buf.st_mode)))
{
/* $KDEHOME/socket-$HOSTNAME is a normal directory. Do nothing. */
- tmp_buf = (char *) malloc(PATH_MAX+1);
- if (!tmp_buf)
- return 0;
-
- strncpy(tmp_buf, kde_tmp_dir, PATH_MAX);
- tmp_buf[ PATH_MAX ] = '\0';
-
+ tmp_buf = strdup(kde_tmp_dir.c_str());
return tmp_buf;
}
@@ -175,26 +163,32 @@ static char *locate_mcop_dir()
}
if ((result == -1) || (!S_ISLNK(stat_buf.st_mode)))
{
- arts_warning("Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir);
+ arts_warning("Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir.c_str());
return 0;
}
- tmp_buf = (char *) malloc(PATH_MAX+1);
- if (!tmp_buf)
- return 0;
/* kde_tmp_dir is a link. Check whether it points to a valid directory. */
- result = readlink(kde_tmp_dir, tmp_buf, PATH_MAX);
- if (result == -1)
- {
- arts_warning("Error: \"%s\" could not be read.\n", kde_tmp_dir);
- free(tmp_buf);
- return 0;
- }
+ ssize_t size = 2048;
+ tmp_buf = NULL;
+ do {
+ size *= 2;
+ tmp_buf = (char *) realloc(tmp_buf, size);
+ if (!tmp_buf)
+ return 0;
+ result = readlink(kde_tmp_dir.c_str(), tmp_buf, size - 1);
+ if (result == -1)
+ {
+ arts_warning("Error: \"%s\" could not be read.\n", kde_tmp_dir.c_str());
+ free(tmp_buf);
+ return 0;
+ }
+ } while(result == size - 1);
tmp_buf[result] = '\0';
+
// printf("Link points to \"%s\"\n", tmp_buf);
- if (strncmp(tmp_buf, user_tmp_dir, strlen(user_tmp_dir)) != 0)
+ if (strncmp(tmp_buf, user_tmp_dir.c_str(), user_tmp_dir.length()) != 0)
{
- arts_warning("Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir, tmp_buf, user_tmp_dir);
+ arts_warning("Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir.c_str(), tmp_buf, user_tmp_dir.c_str());
free(tmp_buf);
return 0;
}
@@ -229,19 +223,19 @@ int create_link(const char *file, const char *tmp_dir)
static
-int build_link(const char *tmp_prefix, const char *kde_prefix)
+int build_link(string tmp_prefix, const char *kde_prefix)
{
struct passwd *pw_ent;
- char kde_tmp_dir[PATH_MAX+1];
- char user_tmp_dir[PATH_MAX+1];
- char tmp_buf[PATH_MAX+1];
+ string kde_tmp_dir;
+ string user_tmp_dir;
+ char *tmp_buf;
int uid = getuid();
const char *home_dir = getenv("HOME");
const char *kde_home = uid ? getenv("KDEHOME") : getenv("KDEROOTHOME");
int result;
struct stat stat_buf;
- kde_tmp_dir[0] = 0;
+ kde_tmp_dir = "";
pw_ent = getpwuid(uid);
if (!pw_ent)
@@ -250,9 +244,7 @@ int build_link(const char *tmp_prefix, const char *kde_prefix)
return 1;
}
- strncpy(user_tmp_dir, tmp_prefix, PATH_MAX);
- user_tmp_dir[ PATH_MAX ] = '\0';
- strncat(user_tmp_dir, pw_ent->pw_name, PATH_MAX - strlen(tmp_prefix));
+ user_tmp_dir = tmp_prefix + string(pw_ent->pw_name);
if (!kde_home || !kde_home[0])
{
@@ -270,89 +262,106 @@ int build_link(const char *tmp_prefix, const char *kde_prefix)
fprintf(stderr, "Aborting. $HOME not set!");
exit(255);
}
- if (strlen(home_dir) > (PATH_MAX-100))
- {
- fprintf(stderr, "Aborting. Home directory path too long!");
- exit(255);
- }
kde_home++;
- strncpy(kde_tmp_dir, home_dir, PATH_MAX);
- kde_tmp_dir[ PATH_MAX ] = '\0';
+ kde_tmp_dir = string(home_dir);
}
- strncat(kde_tmp_dir, kde_home, PATH_MAX - strlen(kde_tmp_dir));
+ kde_tmp_dir += kde_home;
/** Strip trailing '/' **/
- if ( kde_tmp_dir[strlen(kde_tmp_dir)-1] == '/')
- kde_tmp_dir[strlen(kde_tmp_dir)-1] = 0;
+ if ( kde_tmp_dir[kde_tmp_dir.length()-1] == '/')
+ kde_tmp_dir.resize(kde_tmp_dir.length()-1);
- result = stat(kde_tmp_dir, &stat_buf);
+ result = stat(kde_tmp_dir.c_str(), &stat_buf);
if ((result == -1) && (errno == ENOENT))
{
- result = mkdir(kde_tmp_dir, 0700);
+ result = mkdir(kde_tmp_dir.c_str(), 0700);
}
if (result == -1)
{
return 1;
}
- strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir));
- if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
+ kde_tmp_dir += kde_prefix;
{
- perror("Aborting. Could not determine hostname: ");
- exit(255);
+ char buf[1024];
+ if (gethostname(buf, sizeof(buf)-1) != 0)
+ {
+ arts_fatal("Aborting. Could not determine hostname or hostname too long.");
+ }
+ buf[sizeof(buf)-1] = '\0';
+ kde_tmp_dir += buf;
}
- kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
- result = lstat(kde_tmp_dir, &stat_buf);
+ result = lstat(kde_tmp_dir.c_str(), &stat_buf);
if ((result == 0) && (S_ISDIR(stat_buf.st_mode)))
{
/* $KDEHOME/tmp is a normal directory. Do nothing. */
- printf("Directory \"%s\" already exists.\n", kde_tmp_dir);
+ printf("Directory \"%s\" already exists.\n", kde_tmp_dir.c_str());
return 0;
}
if ((result == -1) && (errno == ENOENT))
{
- printf("Creating link %s.\n", kde_tmp_dir);
- result = create_link(kde_tmp_dir, user_tmp_dir);
+ printf("Creating link %s.\n", kde_tmp_dir.c_str());
+ result = create_link(kde_tmp_dir.c_str(), user_tmp_dir.c_str());
if (result == 0) return 0; /* Success */
- unlink(kde_tmp_dir);
- strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir));
- mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
- return create_link(kde_tmp_dir, user_tmp_dir);
+ unlink(kde_tmp_dir.c_str());
+ user_tmp_dir += "XXXXXX";
+ tmp_buf = strdup(user_tmp_dir.c_str());
+ mktemp(tmp_buf); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
+ result = create_link(kde_tmp_dir.c_str(), tmp_buf);
+ free(tmp_buf);
+ return result;
}
if ((result == -1) || (!S_ISLNK(stat_buf.st_mode)))
{
- fprintf(stderr, "Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir);
+ fprintf(stderr, "Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir.c_str());
return 1;
}
/* kde_tmp_dir is a link. Check whether it points to a valid directory. */
- result = readlink(kde_tmp_dir, tmp_buf, PATH_MAX);
- if (result == -1)
- {
- fprintf(stderr, "Error: \"%s\" could not be read.\n", kde_tmp_dir);
- return 1;
- }
+ ssize_t size = 2048;
+ tmp_buf = NULL;
+ do {
+ size *= 2;
+ tmp_buf = (char *) realloc(tmp_buf, size);
+ if (!tmp_buf)
+ return 0;
+ result = readlink(kde_tmp_dir.c_str(), tmp_buf, size - 1);
+ if (result == -1)
+ {
+ arts_warning("Error: \"%s\" could not be read.\n", kde_tmp_dir.c_str());
+ free(tmp_buf);
+ return 0;
+ }
+ } while(result == size - 1);
tmp_buf[result] = '\0';
+
printf("Link points to \"%s\"\n", tmp_buf);
- if (strncmp(tmp_buf, user_tmp_dir, strlen(user_tmp_dir)) != 0)
+ if (strncmp(tmp_buf, user_tmp_dir.c_str(), user_tmp_dir.length()) != 0)
{
- fprintf(stderr, "Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir, tmp_buf, user_tmp_dir);
- unlink(kde_tmp_dir);
- printf("Creating link %s.\n", kde_tmp_dir);
- result = create_link(kde_tmp_dir, user_tmp_dir);
+ fprintf(stderr, "Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir.c_str(), tmp_buf, user_tmp_dir.c_str());
+ free(tmp_buf);
+ unlink(kde_tmp_dir.c_str());
+ printf("Creating link %s.\n", kde_tmp_dir.c_str());
+ result = create_link(kde_tmp_dir.c_str(), user_tmp_dir.c_str());
if (result == 0) return 0; /* Success */
- unlink(kde_tmp_dir);
- strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir));
- mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
- return create_link(kde_tmp_dir, user_tmp_dir);
- return 1;
+ unlink(kde_tmp_dir.c_str());
+ user_tmp_dir += "XXXXXX";
+ tmp_buf = strdup(user_tmp_dir.c_str());
+ mktemp(tmp_buf); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
+ result = create_link(kde_tmp_dir.c_str(), tmp_buf);
+ free(tmp_buf);
+ return result;
}
result = check_tmp_dir(tmp_buf);
+ free(tmp_buf);
if (result == 0) return 0; /* Success */
- unlink(kde_tmp_dir);
- strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir));
- mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
- return create_link(kde_tmp_dir, user_tmp_dir);
+ unlink(kde_tmp_dir.c_str());
+ user_tmp_dir += "XXXXXX";
+ tmp_buf = strdup(user_tmp_dir.c_str());
+ mktemp(tmp_buf); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
+ result = create_link(kde_tmp_dir.c_str(), tmp_buf);
+ free(tmp_buf);
+ return result;
}
string MCOPUtils::createFilePath(string name)
@@ -372,11 +381,7 @@ string MCOPUtils::createFilePath(string name)
if (!tmp || !tmp[0])
tmp = "/tmp";
- char tmp_prefix[PATH_MAX+1];
- strcpy(tmp_prefix, tmp);
- strcat(tmp_prefix, "/ksocket-");
-
- build_link(tmp_prefix, "/socket-");
+ build_link(string(tmp) + "/ksocket-", "/socket-");
mcop_dir = locate_mcop_dir();
}
if (!mcop_dir)
diff --git a/mcop/mcoputils.h b/mcop/mcoputils.h
index c0b8224..3645166 100644
--- a/mcop/mcoputils.h
+++ b/mcop/mcoputils.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): MCOPUtils
+ * BC - Status (2002-03-08): MCOPUtils
*
* Collection class for all kinds of utility functions. BC, since never
* instanciated.
diff --git a/mcop/md5.h b/mcop/md5.h
index a6fe7dd..6954632 100644
--- a/mcop/md5.h
+++ b/mcop/md5.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): arts_md5sum
+ * BC - Status (2002-03-08): arts_md5sum
*
* No binary compatibility guaranteed (part of Dispatcher's security model).
*/
diff --git a/mcop/md5auth.h b/mcop/md5auth.h
index 3c5f94a..e70141f 100644
--- a/mcop/md5auth.h
+++ b/mcop/md5auth.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): arts_md5_*
+ * BC - Status (2002-03-08): arts_md5_*
*
* No guarantees - do not use.
*/
diff --git a/mcop/namedstore.h b/mcop/namedstore.h
index 0d8c29d..89a2b2d 100644
--- a/mcop/namedstore.h
+++ b/mcop/namedstore.h
@@ -29,7 +29,7 @@
#include "stdio.h"
/*
- * BC - tqStatus (2002-03-08): NamedStore
+ * BC - Status (2002-03-08): NamedStore
*
* None of these classes is considered part of the public API. Do NOT use it
* in your apps. These are part of the implementation of object.cc and not
diff --git a/mcop/notification.h b/mcop/notification.h
index 6c306e5..8b3e4b0 100644
--- a/mcop/notification.h
+++ b/mcop/notification.h
@@ -29,7 +29,7 @@
namespace Arts {
/*
- * BC - tqStatus (2002-03-08): Notification, NotificationClient,
+ * BC - Status (2002-03-08): Notification, NotificationClient,
* NotificationManager
*
* All need to be kept BC, NotificationManager with usual d ptr.
diff --git a/mcop/object.h b/mcop/object.h
index de46618..dafddf7 100644
--- a/mcop/object.h
+++ b/mcop/object.h
@@ -34,7 +34,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): Object_base, Object_skel, Object_stub
+ * BC - Status (2002-03-08): Object_base, Object_skel, Object_stub
*
* All of them have to be kept binary compatible carefully, due to interaction
* with generated code. There are d ptrs in _skel and _stub, NOT TO BE USED
diff --git a/mcop/objectmanager.h b/mcop/objectmanager.h
index 33d46c7..53aa65a 100644
--- a/mcop/objectmanager.h
+++ b/mcop/objectmanager.h
@@ -30,7 +30,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): ObjectManager
+ * BC - Status (2002-03-08): ObjectManager
*
* Keep binary compatible (since accessible via ::the()), use d ptr when
* changing it.
diff --git a/mcop/pool.h b/mcop/pool.h
index 45a04ce..d3ca05d 100644
--- a/mcop/pool.h
+++ b/mcop/pool.h
@@ -25,7 +25,7 @@
/*
- * BC - tqStatus (2002-03-08): Pool<type>
+ * BC - Status (2002-03-08): Pool<type>
*
* Needs to be kept binary compatible by NOT TOUCHING. When you want something
* else, write a fresh one (used as part of Arts::Dispatcher, thus changing
diff --git a/mcop/reference.h b/mcop/reference.h
index ba87ab5..a5bea45 100644
--- a/mcop/reference.h
+++ b/mcop/reference.h
@@ -19,7 +19,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): Reference, SubClass, Object, DynamicCast.
+ * BC - Status (2002-03-08): Reference, SubClass, Object, DynamicCast.
*
* Part of the public API. Must be kept binary compatible by NOT TOUCHING
* AT ALL. Interaction with generated and written code.
diff --git a/mcop/referenceclean.h b/mcop/referenceclean.h
index 53d3780..2612ffb 100644
--- a/mcop/referenceclean.h
+++ b/mcop/referenceclean.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): ReferenceClean
+ * BC - Status (2002-03-08): ReferenceClean
*
* None of these classes is considered part of the public API. Do NOT use it
* in your apps. Can be changed arbitrarily even non BC.
diff --git a/mcop/socketconnection.h b/mcop/socketconnection.h
index d30927f..86c400a 100644
--- a/mcop/socketconnection.h
+++ b/mcop/socketconnection.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): SocketConnection
+ * BC - Status (2002-03-08): SocketConnection
*
* None of these classes is considered part of the public API. Do NOT use it
* in your apps. No BC guaranteed.
diff --git a/mcop/startupmanager.h b/mcop/startupmanager.h
index b4089a3..c0644c5 100644
--- a/mcop/startupmanager.h
+++ b/mcop/startupmanager.h
@@ -28,7 +28,7 @@
#include <list>
/*
- * BC - tqStatus (2002-03-08): StartupClass, StartupManager.
+ * BC - Status (2002-03-08): StartupClass, StartupManager.
*
* The class needs to be kept BC, as the startup system bases on inheritance
* and virtual functions. Do not change.
diff --git a/mcop/tcpconnection.h b/mcop/tcpconnection.h
index e09474a..4fadef6 100644
--- a/mcop/tcpconnection.h
+++ b/mcop/tcpconnection.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): TCPConnection
+ * BC - Status (2002-03-08): TCPConnection
*
* Not part of the public API. Do NOT use it in your apps. Binary incompatible
* changes allowed.
diff --git a/mcop/tcpserver.h b/mcop/tcpserver.h
index 59ee44e..4c31540 100644
--- a/mcop/tcpserver.h
+++ b/mcop/tcpserver.h
@@ -27,7 +27,7 @@
#include "arts_export.h"
#include "iomanager.h"
/*
- * BC - tqStatus (2002-03-08): TCPServer
+ * BC - Status (2002-03-08): TCPServer
*
* Not part of the public API. Do NOT use it in your apps. Binary incompatible
* changes allowed.
diff --git a/mcop/thread.h b/mcop/thread.h
index c7ce9ec..d81010d 100644
--- a/mcop/thread.h
+++ b/mcop/thread.h
@@ -26,7 +26,7 @@
#include "arts_export.h"
/*
- * BC - tqStatus (2002-03-08): SystemThreads, Thread, Mutex, ThreadCondition,
+ * BC - Status (2002-03-08): SystemThreads, Thread, Mutex, ThreadCondition,
* Semaphore
*
* These classes are kept binary compatible. As the threading implementation
diff --git a/mcop/type.h b/mcop/type.h
index 4cdd3f6..a4ca501 100644
--- a/mcop/type.h
+++ b/mcop/type.h
@@ -27,7 +27,7 @@
#include "buffer.h"
/*
- * BC - tqStatus (2002-03-08): Type
+ * BC - Status (2002-03-08): Type
*
* Keep binary compatible. DO NOT TOUCH, DO NOT CHANGE.
*/
diff --git a/mcop/unixconnection.h b/mcop/unixconnection.h
index c8d2d20..0640670 100644
--- a/mcop/unixconnection.h
+++ b/mcop/unixconnection.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): UnixConnection
+ * BC - Status (2002-03-08): UnixConnection
*
* Not part of the public API. Do NOT use it in your apps. Can change, even
* binary incompatible.
diff --git a/mcop/unixserver.h b/mcop/unixserver.h
index 3220e42..fa91fba 100644
--- a/mcop/unixserver.h
+++ b/mcop/unixserver.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): UnixServer
+ * BC - Status (2002-03-08): UnixServer
*
* Not part of the public API. Do NOT use it in your apps. Can change, even
* binary incompatible.
diff --git a/mcop/weakreference.h b/mcop/weakreference.h
index a91bc0d..344eacb 100644
--- a/mcop/weakreference.h
+++ b/mcop/weakreference.h
@@ -21,7 +21,7 @@
*/
/*
- * BC - tqStatus (2002-03-08): WeakReference(Base)
+ * BC - Status (2002-03-08): WeakReference(Base)
*
* Has to be kept binary compatible by not touching it. Add a new class if
* you need something else.