This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 3276d9061c5053433ebc9c3cfa1e1e2a87171256
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Dec 4 13:45:51 2019 +0000
restoremeta: Use zlib by file descriptor
Open the metadata file with open and pass the fd to zlib instead of the
path. This is groundwork for supporting bzip2. (gzclose() still closes
the fd later).
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 18432b7..9de53a9 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -1197,6 +1197,7 @@ void restoremeta(const char *in_fn, const char *out_device, uint64_t
printonly)
gzFile gzfd;
off_t pos = 0;
struct savemeta_header smh = {0};
+ int fd;
termlines = 0;
if (!in_fn)
@@ -1204,7 +1205,12 @@ void restoremeta(const char *in_fn, const char *out_device,
uint64_t printonly)
if (!printonly && !out_device)
complain("No destination file system specified.");
- gzfd = gzopen(in_fn, "rb");
+ fd = open(in_fn, O_RDONLY|O_CLOEXEC);
+ if (fd < 0) {
+ perror("Could not open file");
+ exit(1);
+ }
+ gzfd = gzdopen(fd, "rb");
if (!gzfd)
die("Can't open source file %s: %s\n",
in_fn, strerror(errno));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date