1 /* Regression test for RHBZ#501893.
2 * Test that String parameters are checked for != NULL.
3 * Copyright (C) 2009-2010 Red Hat Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 main (int argc, char *argv[])
31 guestfs_h *g = guestfs_create ();
33 /* Call some non-daemon functions that have a String parameter, but
34 * setting that parameter to NULL. Previously this would cause a
35 * segfault inside libguestfs. After this bug was fixed, this
36 * turned into an error message.
39 assert (guestfs_add_drive (g, NULL) == -1);
40 assert (guestfs_config (g, NULL, NULL) == -1);
42 /* This optional argument must not be NULL. */
44 assert (guestfs_add_drive_opts (g, "/dev/null",
45 GUESTFS_ADD_DRIVE_OPTS_FORMAT, NULL,
48 /* These can be safely set to NULL, should be no error. */
50 assert (guestfs_set_path (g, NULL) == 0);
51 assert (guestfs_set_append (g, NULL) == 0);
52 assert (guestfs_set_qemu (g, NULL) == 0);