Fully branch cat and ls
This commit is contained in:
@@ -108,24 +108,28 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
|
||||
|
||||
printf("Size: %zu\tContent size: %zu\n", zmsg_size(msg), zmsg_content_size(msg));
|
||||
struct guestfs_inpsect_command *command = zmsg_to_command(msg);
|
||||
printf("Name: %s\n", command->name);
|
||||
printf("paths: %zu\n", command->args.ls.paths_length);
|
||||
printf("path: %s\n", command->args.ls.paths[0]);
|
||||
|
||||
free(command);
|
||||
|
||||
// Sending reply
|
||||
/* zmsg_send(&msg, pipe); */
|
||||
|
||||
zmsg_t *reply = zmsg_new();
|
||||
if (!reply) {
|
||||
printf("wuddahec\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
zmsg_pushstr(reply, "From worker!");
|
||||
|
||||
zmsg_send(&reply, pipe);
|
||||
switch (command->command) {
|
||||
case GUESTFS_COMMAND_LS:
|
||||
zmsg_pushstr(reply, "From worker!");
|
||||
break;
|
||||
case GUESTFS_COMMAND_CAT:
|
||||
char *res;
|
||||
size_t s;
|
||||
cat_file(g, command->args.cat.paths[0], &res, &s);
|
||||
zmsg_addmem(reply, res, s);
|
||||
break;
|
||||
}
|
||||
|
||||
// Sending reply
|
||||
zmsg_send(&reply, pipe);
|
||||
|
||||
command_destroy(&command);
|
||||
zmsg_destroy(&msg);
|
||||
zmsg_destroy(&reply);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user