testing errors

This commit is contained in:
Pin
2024-03-03 18:46:41 -05:00
parent c6f9204014
commit 20fc94fb35

View File

@@ -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) {
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);
if ((*file_content) == NULL) {
exit(EXIT_FAILURE);
@@ -42,9 +43,6 @@ static void init_guestfs(guestfs_h *g, char *disk_path) {
char *root;
size_t i, j;
//char *file_content;
//size_t file_size;
// Create a connection handle
g = guestfs_create();
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) {
guestfs_h *g = NULL;
init_guestfs(g, disk_path);
//init_guestfs(g, disk_path);
// ZeroMQ Opens here
zsock_signal(pipe, 0);
@@ -122,7 +120,12 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
char *res;
size_t s;
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...");
zmsg_addmem(reply, res, s);
break;