mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tests: switch away from xgetcwd
xgetcwd is used only in a test, so there is no need to pull a gnulib module just for it. Switch to use getcwd directly with a fixed buffer: the tests would have failed with paths longer than 992 characters, as the libvirt_uri would have been truncated. Since there were no reports of issues, we can assume that the current working directory will fit in 1024 characters; adapt the size of libvirt_uri accordingly.
This commit is contained in:
@@ -28,8 +28,6 @@
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
#include "xgetcwd.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "guestfs-utils.h"
|
||||
|
||||
@@ -76,11 +74,12 @@ main (int argc, char *argv[])
|
||||
virErrorPtr err;
|
||||
int r;
|
||||
char *backend;
|
||||
char *cwd;
|
||||
char cwd[1024];
|
||||
FILE *fp;
|
||||
char libvirt_uri[1024];
|
||||
char libvirt_uri[sizeof cwd + 64];
|
||||
|
||||
cwd = xgetcwd ();
|
||||
if (getcwd (cwd, sizeof cwd) == NULL)
|
||||
error (EXIT_FAILURE, errno, "getcwd");
|
||||
|
||||
/* Create the guestfs handle. */
|
||||
g = guestfs_create ();
|
||||
@@ -147,7 +146,6 @@ main (int argc, char *argv[])
|
||||
|
||||
virDomainFree (dom);
|
||||
virConnectClose (conn);
|
||||
free (cwd);
|
||||
|
||||
unlink ("test-add-libvirt-dom.xml");
|
||||
unlink ("test-add-libvirt-dom-1.img");
|
||||
|
||||
Reference in New Issue
Block a user