summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/marker/src/marker.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 7111c7cd3cf..47ce20f861a 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -978,12 +978,11 @@ call_from_sp_client_to_reset_tmfile (call_frame_t *frame,
xlator_t *this,
dict_t *dict)
{
- 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,};
+ int32_t fd = 0;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
+ data_t *data = NULL;
+ marker_conf_t *priv = NULL;
if (frame == NULL || this == NULL || dict == NULL)
return -1;
@@ -1003,18 +1002,24 @@ 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);
+ }
- 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");
+ if (fd != -1 || errno == ENOENT) {
+ op_ret = 0;
+ op_errno = 0;
+ } else {
op_ret = -1;
op_errno = errno;
- goto out;
}
-
} else {
op_ret = -1;
op_errno = EINVAL;