diff options
author | Rajesh Amaravathi <rajesh.amaravathi@gmail.com> | 2011-09-19 14:25:47 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-19 02:27:25 -0700 |
commit | 39fee9a8f8264df61f77563acb048a441265afcf (patch) | |
tree | 8b8ef88f5bfcb60f47d5b56eec995464d2abc905 | |
parent | 909f80181c9a6985c49964de4854f5d5460dbf09 (diff) |
glusterd: make sort portable
fixed for fd leaking. reopening of file was not needed
BUG: 3491
Change-Id: I1351bdcaa41a5901574f5e779c33bf6f80a938f9
Reviewed-on: http://review.gluster.com/453
Reviewed-by: Csaba Henk <csaba@gluster.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index f519af63d87..209138acae2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1340,24 +1340,17 @@ glusterd_volume_compute_cksum (glusterd_volinfo_t *volinfo) } /* sort the info file, result in sort_filepath */ - sort_fd = open (sort_filepath, O_WRONLY | O_CREAT, 0644); - if (sort_fd < 0) { - gf_log (THIS->name, GF_LOG_ERROR, "failed to open file %s", - sort_filepath); - goto out; - } - runinit (&runner); runner_add_args (&runner, "sort", filepath, NULL); runner_redir (&runner, STDOUT_FILENO, sort_fd); ret = runner_run (&runner); + close (sort_fd); if (ret) { gf_log (THIS->name, GF_LOG_ERROR, "failed to sort file %s to %s", filepath, sort_filepath); goto out; } - close (sort_fd); ret = get_checksum_for_path (sort_filepath, &cksum); if (ret) { |