summaryrefslogtreecommitdiffstats
path: root/common/os_calls.c
diff options
context:
space:
mode:
authornorrarvid <norrarvid@gmail.com>2012-05-30 07:40:06 +0200
committernorrarvid <norrarvid@gmail.com>2012-05-30 07:40:06 +0200
commit02f3fe1e2a2f971246d7775468425636a05e6246 (patch)
treeef324e605947917f5e699d67440f3e68cf0d4e34 /common/os_calls.c
parent2109d7a044430ee4ad5b51f2c18cc496be0e7fd8 (diff)
downloadxrdp-proprietary-02f3fe1e2a2f971246d7775468425636a05e6246.tar.gz
xrdp-proprietary-02f3fe1e2a2f971246d7775468425636a05e6246.zip
Improved error handling for module load and init, fixed bug in logwindow
Diffstat (limited to 'common/os_calls.c')
-rw-r--r--common/os_calls.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 80e5bad3..ae48fc94 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -1579,7 +1579,32 @@ g_strdup(const char* in)
}
return p;
}
+/*****************************************************************************/
+/* if in = 0, return 0 else return newly alloced copy of input string
+ * if the input string is larger than maxlen the returned string will be
+ * truncated. All strings returned will include null termination*/
+char* APP_CC
+g_strndup(const char* in, const unsigned int maxlen)
+{
+ int len;
+ char* p;
+ if (in == 0)
+ {
+ return 0;
+ }
+ len = g_strlen(in);
+ if(len>maxlen)
+ {
+ len = maxlen-1 ;
+ }
+ p = (char*)g_malloc(len + 2, 0);
+ if (p != NULL)
+ {
+ g_strncpy(p, in,len+1);
+ }
+ return p;
+}
/*****************************************************************************/
int APP_CC
g_strcmp(const char* c1, const char* c2)