diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-02-15 03:09:02 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-14 11:06:35 -0700 |
commit | ab7dc7aafa61ae66db4ce7aa5e33e3ee408fd878 (patch) | |
tree | 51bae629139a8e0c86af4219ba5fa4da42d29c9e /xlators | |
parent | da57b8e7541ced2be0464f461e29dc7428bbcb14 (diff) |
Revert "features/marker: Use touch TimeStamp file instead of futimens, to avoid the dependency of newer libc"
This reverts commit e045741f2bb75344a557cd618e1c7b1691238703.
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2354 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2354
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/marker/src/marker.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 7111c7cd3..47ce20f86 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; |