Skip to content

Commit 6209257

Browse files
dwsuseigaw
authored andcommitted
json: dump the output to the user selected filedescriptor
Allow the user to select the output filedescriptor instead always dumping it to stdout. This allows to write the output to a file. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 4e37a05 commit 6209257

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/nvme/json.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,9 @@ int json_dump_tree(nvme_root_t r)
576576
}
577577
json_object_object_add(json_root, "hosts", host_array);
578578

579-
ret = json_object_to_fd(1, json_root, JSON_C_TO_STRING_PRETTY);
579+
ret = json_object_to_fd(fileno(r->fp), json_root, JSON_C_TO_STRING_PRETTY);
580580
if (ret < 0) {
581-
nvme_msg(r, LOG_ERR, "Failed to write to stdout, %s\n",
581+
nvme_msg(r, LOG_ERR, "Failed to write, %s\n",
582582
json_util_get_last_err());
583583
ret = -1;
584584
errno = EIO;

0 commit comments

Comments
 (0)