Displaying 3 results from an estimated 3 matches for "rel_filename".
2017 Dec 15
2
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename
v1 posted here:
https://www.redhat.com/archives/libguestfs/2017-December/msg00050.html
v2 fixes the tests by rewriting relative paths as ./filename
(so that filenames like "file:foo" work).
2018 Jan 12
1
Re: [PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.
...ves/libguestfs/2017-December/thread.html#00044
> ---
Mostly LGTM -- a couple of notes below.
> - guestfs_int_cmd_clear_close_files (cmd);
Don't we want this regardless?
> + if (filename[0] == '/')
> + guestfs_int_cmd_add_arg (cmd, filename);
> + else {
> + rel_filename = safe_asprintf (g, "./%s", filename);
> + guestfs_int_cmd_add_arg (cmd, rel_filename);
There's guestfs_int_cmd_add_arg_format, so that can be used to avoid
the temporary string.
Thanks,
--
Pino Toscano
2017 Dec 15
0
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.
...ude <sys/wait.h>
#include <assert.h>
#include <string.h>
@@ -166,41 +165,24 @@ static yajl_val
get_json_output (guestfs_h *g, const char *filename)
{
CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g);
- int fd, r;
- char fdpath[64];
+ CLEANUP_FREE char *rel_filename = NULL;
+ int r;
yajl_val tree = NULL;
- struct stat statbuf;
-
- fd = open (filename, O_RDONLY /* NB: !O_CLOEXEC */);
- if (fd == -1) {
- perrorf (g, "disk info: %s", filename);
- return NULL;
- }
-
- if (fstat (fd, &statbuf) == -1) {
- perrorf (g, "disk info:...