summaryrefslogtreecommitdiffstats
path: root/xorg
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-02-12 21:20:23 -0800
committerJay Sorg <jay.sorg@gmail.com>2012-02-12 21:20:23 -0800
commitc37524c7337e491d8ba7f5d9f6ce1306ae23fd4c (patch)
tree06a6c7b3e8f5c3371c170cb50743252c6c51b986 /xorg
parent3e90b6c9cff16590ba0c3c6d994d800612262cec (diff)
downloadxrdp-proprietary-c37524c7337e491d8ba7f5d9f6ce1306ae23fd4c.tar.gz
xrdp-proprietary-c37524c7337e491d8ba7f5d9f6ce1306ae23fd4c.zip
xorg/tests: minor fixes
Diffstat (limited to 'xorg')
-rw-r--r--xorg/tests/tcp_proxy/os_calls.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/xorg/tests/tcp_proxy/os_calls.c b/xorg/tests/tcp_proxy/os_calls.c
index b17856bc..60dbcd69 100644
--- a/xorg/tests/tcp_proxy/os_calls.c
+++ b/xorg/tests/tcp_proxy/os_calls.c
@@ -578,31 +578,38 @@ g_tcp_select(int sck1, int sck2)
return rv;
}
-
/*****************************************************************************/
void APP_CC
g_random(char* data, int len)
{
- #if defined(_WIN32)
- memset(data, 0x44, len);
- #else
- int fd;
-
- memset(data, 0x44, len);
- fd = open("/dev/urandom", O_RDONLY);
- if (fd == -1)
- {
- fd = open("/dev/random", O_RDONLY);
- }
- if (fd != -1)
+#if defined(_WIN32)
+ int index;
+
+ srand(g_time1());
+ for (index = 0; index < len; index++)
+ {
+ data[index] = (char)rand(); /* rand returns a number between 0 and
+ RAND_MAX */
+ }
+#else
+ int fd;
+
+ memset(data, 0x44, len);
+ fd = open("/dev/urandom", O_RDONLY);
+ if (fd == -1)
+ {
+ fd = open("/dev/random", O_RDONLY);
+ }
+ if (fd != -1)
+ {
+ if (read(fd, data, len) != len)
{
- read(fd, data, len);
- close(fd);
}
- #endif
+ close(fd);
+ }
+#endif
}
-
/*****************************************************************************/
int APP_CC
g_abs(int i)
@@ -802,7 +809,6 @@ g_mkdir(const char* dirname)
#endif
}
-
/*****************************************************************************/
/* gets the current working directory and puts up to maxlen chars in
dirname
@@ -810,16 +816,17 @@ g_mkdir(const char* dirname)
char* APP_CC
g_get_current_dir(char* dirname, int maxlen)
{
- #if defined(_WIN32)
- GetCurrentDirectory(maxlen, dirname);
- return 0;
- #else
- getcwd(dirname, maxlen);
- return 0;
- #endif
+#if defined(_WIN32)
+ GetCurrentDirectoryA(maxlen, dirname);
+ return 0;
+#else
+ if (getcwd(dirname, maxlen) == 0)
+ {
+ }
+ return 0;
+#endif
}
-
/*****************************************************************************/
/* returns error, zero on success and -1 on failure */
int APP_CC