summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-02-08 04:05:21 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-10 22:17:30 -0800
commite045741f2bb75344a557cd618e1c7b1691238703 (patch)
tree3761493084ba56cd209e34740102ad8448c136a0
parentff7a493428e011f961d541e59e52ddb53c331d9c (diff)
features/marker: Use touch TimeStamp file instead of futimens, to avoid the dependency of newer libc
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2354 (handling futimens with older glibc) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2354
-rw-r--r--xlators/features/marker/src/marker.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 47ce20f86..7111c7cd3 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -978,11 +978,12 @@ call_from_sp_client_to_reset_tmfile (call_frame_t *frame,
xlator_t *this,
dict_t *dict)
{
- int32_t fd = 0;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
- data_t *data = NULL;
- marker_conf_t *priv = NULL;
+ int32_t ret = 0;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
+ data_t *data = NULL;
+ marker_conf_t *priv = NULL;
+ char cmd_str[8192] = {0,};
if (frame == NULL || this == NULL || dict == NULL)
return -1;
@@ -1002,24 +1003,18 @@ call_from_sp_client_to_reset_tmfile (call_frame_t *frame,
if (data->len == 0 || (data->len == 5 &&
memcmp (data->data, "RESET", 5) == 0)) {
- fd = open (priv->timestamp_file, O_WRONLY);
- if (fd != -1) {
- /* this call is needed because of the unsurity
- * whether the O_TRUNC would update the timestamps
- * on a zero length file as well. Hence updating it
- * manually.
- */
- futimens (fd, NULL);
- close (fd);
- }
- if (fd != -1 || errno == ENOENT) {
- op_ret = 0;
- op_errno = 0;
- } else {
+ snprintf (cmd_str, 8192,"touch %s", priv->timestamp_file);
+ ret = system (cmd_str);
+
+ if (-1 == ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Could not touch TimeStamp file of marker");
op_ret = -1;
op_errno = errno;
+ goto out;
}
+
} else {
op_ret = -1;
op_errno = EINVAL;