summaryrefslogtreecommitdiffstats
path: root/geo-replication/src/gsyncd.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2015-10-01 16:31:19 -0400
committerJeff Darcy <jdarcy@redhat.com>2015-10-28 13:38:42 -0700
commit3066a21caafab6305527991de11c8eb43ec0044c (patch)
tree5efc91272ac76ff1613cee1e8a41aeb32aa92d73 /geo-replication/src/gsyncd.c
parent063d4ead61ee47433793de81a1c77e0ba69e6e07 (diff)
core: use syscall wrappers instead of direct syscalls - miscellaneous
various xlators and other components are invoking system calls directly instead of using the libglusterfs/syscall.[ch] wrappers. If not using the system call wrappers there should be a comment in the source explaining why the wrapper isn't used. Change-Id: I1f47820534c890a00b452fa61f7438eb2b3f667c BUG: 1267967 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/12276 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'geo-replication/src/gsyncd.c')
-rw-r--r--geo-replication/src/gsyncd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/geo-replication/src/gsyncd.c b/geo-replication/src/gsyncd.c
index c9c863ca2fd..1beeda1380c 100644
--- a/geo-replication/src/gsyncd.c
+++ b/geo-replication/src/gsyncd.c
@@ -7,6 +7,8 @@
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/
+#include "compat.h"
+#include "syscall.h"
#include <stdlib.h>
#include <stdio.h>
@@ -189,12 +191,12 @@ find_gsyncd (pid_t pid, pid_t ppid, char *name, void *data)
if (ppid != pida[0])
return 0;
- sprintf (path, PROC"/%d/cmdline", pid);
+ snprintf (path, sizeof path, PROC"/%d/cmdline", pid);
fd = open (path, O_RDONLY);
if (fd == -1)
return 0;
- ret = read (fd, buf, sizeof (buf));
- close (fd);
+ ret = sys_read (fd, buf, sizeof (buf));
+ sys_close (fd);
if (ret == -1)
return 0;
for (zeros = 0, p = buf; zeros < 2 && p < buf + ret; p++)
@@ -270,8 +272,8 @@ invoke_rsync (int argc, char **argv)
goto error;
}
/* check if rsync target matches gsyncd target */
- sprintf (path, PROC"/%d/cwd", pida[1]);
- ret = readlink (path, buf, sizeof (buf));
+ snprintf (path, sizeof path, PROC"/%d/cwd", pida[1]);
+ ret = sys_readlink (path, buf, sizeof (buf));
if (ret == -1 || ret == sizeof (buf))
goto error;
if (strcmp (argv[argc - 1], "/") == 0 /* root dir cannot be a target */ ||