summaryrefslogtreecommitdiffstats
path: root/common/os_calls.c
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2005-01-21 03:55:16 +0000
committerjsorg71 <jsorg71>2005-01-21 03:55:16 +0000
commitf0c7bdb304846829259edaab25454f81ab5a4c36 (patch)
treeba94a6f4a45f29c741490e06bf89deca50041874 /common/os_calls.c
parentb2741d1ed23982d0bfd3016d998c4cbfb3c4ab8e (diff)
downloadxrdp-proprietary-f0c7bdb304846829259edaab25454f81ab5a4c36.tar.gz
xrdp-proprietary-f0c7bdb304846829259edaab25454f81ab5a4c36.zip
added pointer cache, some debug messages and some other fixes
Diffstat (limited to 'common/os_calls.c')
-rw-r--r--common/os_calls.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index e6422b83..9b3a9e31 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -751,7 +751,9 @@ int g_file_lock(int fd, int start, int len)
lock.l_start = start;
lock.l_len = len;
if (fcntl(fd, F_SETLK, &lock) == -1)
+ {
return 0;
+ }
return 1;
#endif
}
@@ -759,12 +761,25 @@ int g_file_lock(int fd, int start, int len)
/*****************************************************************************/
int g_strlen(char* text)
{
+ if (text == 0)
+ {
+ return 0;
+ }
return strlen(text);
}
/*****************************************************************************/
char* g_strcpy(char* dest, char* src)
{
+ if (src == 0 && dest != 0)
+ {
+ dest[0] = 0;
+ return dest;
+ }
+ if (dest == 0 || src == 0)
+ {
+ return 0;
+ }
return strcpy(dest, src);
}
@@ -773,6 +788,15 @@ char* g_strncpy(char* dest, char* src, int len)
{
char* rv;
+ if (src == 0 && dest != 0)
+ {
+ dest[0] = 0;
+ return dest;
+ }
+ if (dest == 0 || src == 0)
+ {
+ return 0;
+ }
rv = strncpy(dest, src, len);
dest[len] = 0;
return rv;
@@ -781,6 +805,10 @@ char* g_strncpy(char* dest, char* src, int len)
/*****************************************************************************/
char* g_strcat(char* dest, char* src)
{
+ if (dest == 0 || src == 0)
+ {
+ return 0;
+ }
return strcat(dest, src);
}
@@ -791,7 +819,9 @@ char* g_strdup(char* in)
char* p;
if (in == 0)
+ {
return 0;
+ }
len = g_strlen(in);
p = (char*)g_malloc(len + 1, 0);
g_strcpy(p, in);
@@ -814,7 +844,9 @@ int g_load_library(char* in)
int g_free_library(int lib)
{
if (lib == 0)
+ {
return 0;
+ }
return dlclose((void*)lib);
}
@@ -823,7 +855,9 @@ int g_free_library(int lib)
void* g_get_proc_address(int lib, char* name)
{
if (lib == 0)
+ {
return 0;
+ }
return dlsym((void*)lib, name);
}