testing errors
This commit is contained in:
@@ -29,6 +29,7 @@ static int count_mountpoints(char *const *argv) {
|
|||||||
|
|
||||||
static void cat_file(guestfs_h *g, char *file_path, char **file_content, size_t *file_size) {
|
static void cat_file(guestfs_h *g, char *file_path, char **file_content, size_t *file_size) {
|
||||||
if (guestfs_is_file_opts(g, file_path, GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
|
if (guestfs_is_file_opts(g, file_path, GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
|
||||||
|
printf("path:: %s\n", file_path);
|
||||||
(*file_content) = guestfs_read_file(g, file_path, file_size);
|
(*file_content) = guestfs_read_file(g, file_path, file_size);
|
||||||
if ((*file_content) == NULL) {
|
if ((*file_content) == NULL) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@@ -42,9 +43,6 @@ static void init_guestfs(guestfs_h *g, char *disk_path) {
|
|||||||
char *root;
|
char *root;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
//char *file_content;
|
|
||||||
//size_t file_size;
|
|
||||||
|
|
||||||
// Create a connection handle
|
// Create a connection handle
|
||||||
g = guestfs_create();
|
g = guestfs_create();
|
||||||
if (g == NULL) {
|
if (g == NULL) {
|
||||||
@@ -92,7 +90,7 @@ static void init_guestfs(guestfs_h *g, char *disk_path) {
|
|||||||
static void *worker_task(zsock_t *pipe, char *disk_path) {
|
static void *worker_task(zsock_t *pipe, char *disk_path) {
|
||||||
guestfs_h *g = NULL;
|
guestfs_h *g = NULL;
|
||||||
|
|
||||||
init_guestfs(g, disk_path);
|
//init_guestfs(g, disk_path);
|
||||||
|
|
||||||
// ZeroMQ Opens here
|
// ZeroMQ Opens here
|
||||||
zsock_signal(pipe, 0);
|
zsock_signal(pipe, 0);
|
||||||
@@ -122,7 +120,12 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
|
|||||||
char *res;
|
char *res;
|
||||||
size_t s;
|
size_t s;
|
||||||
puts("catting file...");
|
puts("catting file...");
|
||||||
cat_file(g, command->args.cat.paths[0], &res, &s);
|
//cat_file(g, command->args.cat.paths[0], &res, &s);
|
||||||
|
init_guestfs(g, disk_path);
|
||||||
|
printf("STATUS::%d\n", guestfs_get_state(g));
|
||||||
|
if(guestfs_is_file_opts(g, "/etc/os-release", GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
|
||||||
|
res = guestfs_read_file(g, "/etc/os-release", &s);
|
||||||
|
}
|
||||||
puts("Done catting file contents...");
|
puts("Done catting file contents...");
|
||||||
zmsg_addmem(reply, res, s);
|
zmsg_addmem(reply, res, s);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user