This is an automated email from the ASF dual-hosted git repository.

vieiro pushed a commit to branch cnd
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/cnd by this push:
     new 7d72ee1  [NETBEANS-5485][CND] cnd-rfs compile fix
7d72ee1 is described below

commit 7d72ee1b57e98f6990e0b052a58db2f9f90948c0
Author: Antonio Vieiro <anto...@vieiro.net>
AuthorDate: Fri Apr 2 19:00:39 2021 +0200

    [NETBEANS-5485][CND] cnd-rfs compile fix
---
 cnd/cnd.remote/tools/Makefile         |  4 ++--
 cnd/cnd.remote/tools/rfs_controller.c | 16 ++++++++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/cnd/cnd.remote/tools/Makefile b/cnd/cnd.remote/tools/Makefile
index 3cfc499..2c859c6 100644
--- a/cnd/cnd.remote/tools/Makefile
+++ b/cnd/cnd.remote/tools/Makefile
@@ -38,11 +38,11 @@ CFLAGS-Linux := ${CFLAGS-COMMON} -Wreturn-type -Wimplicit 
-Werror -std=c99 ${PRE
 CFLAGS-SunOS := ${CFLAGS-COMMON} -xc99 -errwarn ${PREVISE_FLAG}
 CFLAGS-Mac_OS_X := ${CFLAGS-COMMON}
 
-LDFLAGS-LIB-Linux := -shared -ldl -lrt
+LDFLAGS-LIB-Linux := -shared -lpthread -ldl -lrt
 LDFLAGS-LIB-SunOS := -shared -ldl -lrt -lsocket
 LDFLAGS-LIB-Mac_OS_X := -G -ldl -lrt
 
-LDFLAGS-APP-Linux := -lrt -lnsl -lresolv
+LDFLAGS-APP-Linux := -lpthread -lrt -lnsl -lresolv
 LDFLAGS-APP-SunOS := -lrt -lnsl -lsocket -lresolv
 LDFLAGS-APP-Mac_OS_X := -lrt -lnsl -lsocket -lresolv
 
diff --git a/cnd/cnd.remote/tools/rfs_controller.c 
b/cnd/cnd.remote/tools/rfs_controller.c
index d49adc7..ad04a23 100644
--- a/cnd/cnd.remote/tools/rfs_controller.c
+++ b/cnd/cnd.remote/tools/rfs_controller.c
@@ -412,12 +412,24 @@ static void free_file_list(file_elem* list) {
 
 static void calc_fs_skew(struct timeval *skew) {
 
+
     skew->tv_sec = 0;
     skew->tv_usec = 0;
+
+    const char * FS_SKEW_PREFIX = "/tmpXXXXXX";
+    const int FS_SKEW_PREFIX_LEN = strlen(FS_SKEW_PREFIX);
     
     char path[PATH_MAX+1];
-    getcwd(path, sizeof path);
-    strncat(path, "/tmpXXXXXX", sizeof path);
+    const char * cwd = getcwd(path, (sizeof path) - 1);
+    if (cwd == NULL) {
+        perror("rfs_controller: cannot get current working directory:");
+        return;
+    }
+    if ((sizeof path) < strlen(path) + FS_SKEW_PREFIX_LEN + 1) {
+        fprintf(stderr, "rfs_controller: path '%s' too large.", path);
+        return;
+    }
+    strncat(path, FS_SKEW_PREFIX, FS_SKEW_PREFIX_LEN + 1);
 
     int fd;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to