Add initial endpoint function

This commit is contained in:
2024-03-02 22:03:28 -05:00
parent 3ffa4cdd6a
commit 7e2b619148

View File

@@ -6,6 +6,8 @@
void *worker_task; void *worker_task;
char *endpoint(void);
int main(int argc, char **argv) { int main(int argc, char **argv) {
if (argc < 2) { if (argc < 2) {
printf("Usage: %s <disk-path> ...\n", argv[0]); printf("Usage: %s <disk-path> ...\n", argv[0]);
@@ -25,3 +27,11 @@ int main(int argc, char **argv) {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
char *endpoint() {
// TODO: This should be based on GUESTFS_INSPECT_ENDPOINT, or XDG_RUNTIME_DIR if the former is not set, and default to a sensible path if neither are set.
const char* ep = "ipc:///tmp/guestfs-inspect.sock";
char *res = malloc(strlen(ep) + 1);
strcpy(res, ep);
return res;
}