search for: prog_exist

Displaying 20 results from an estimated 66 matches for "prog_exist".

Did you mean: prog_exists
2015 Jun 23
2
[PATCH] daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list.
...aemon/guestfsd.c @@ -243,9 +243,6 @@ main (int argc, char *argv[]) /* Set up a basic environment. After we are called by /init the * environment is essentially empty. * https://bugzilla.redhat.com/show_bug.cgi?id=502074#c5 - * - * NOTE: if you change $PATH, you must also change 'prog_exists' - * function below. */ setenv ("PATH", "/sbin:/usr/sbin:/bin:/usr/bin", 1); setenv ("SHELL", "/bin/sh", 1); @@ -1440,22 +1437,34 @@ mountable_to_string (const mountable_t *mountable) } } -/* Check program exists and is executable on $P...
2015 Jun 23
0
Re: [PATCH] daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list.
...9 +243,6 @@ main (int argc, char *argv[]) > /* Set up a basic environment. After we are called by /init the > * environment is essentially empty. > * https://bugzilla.redhat.com/show_bug.cgi?id=502074#c5 > - * > - * NOTE: if you change $PATH, you must also change 'prog_exists' > - * function below. > */ > setenv ("PATH", "/sbin:/usr/sbin:/bin:/usr/bin", 1); > setenv ("SHELL", "/bin/sh", 1); > @@ -1440,22 +1437,34 @@ mountable_to_string (const mountable_t *mountable) > } > } > > -/*...
2017 Jul 27
0
[PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
...tr_umount, umount); -GUESTFSD_EXT_CMD(str_btrfsimage, btrfs-image); - COMPILE_REGEXP (re_btrfs_subvolume_list, "ID\\s+(\\d+).*\\s" "top level\\s+(\\d+).*\\s" @@ -51,7 +44,7 @@ int optgroup_btrfs_available (void) { return test_mode || - (prog_exists (str_btrfs) && filesystem_available ("btrfs") > 0); + (prog_exists ("btrfs") && filesystem_available ("btrfs") > 0); } char * @@ -62,7 +55,7 @@ btrfs_get_label (const char *device) char *out = NULL; size_t len; - r = command (&amp...
2017 Jul 24
0
[PATCH 2/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.
...t;, "btrfsck", "mkfs.btrfs", + "umount", "btrfs-image") COMPILE_REGEXP (re_btrfs_subvolume_list, "ID\\s+(\\d+).*\\s" @@ -51,7 +47,7 @@ int optgroup_btrfs_available (void) { return test_mode || - (prog_exists (str_btrfs) && filesystem_available ("btrfs") > 0); + (prog_exists ("btrfs") && filesystem_available ("btrfs") > 0); } char * @@ -62,7 +58,7 @@ btrfs_get_label (const char *device) char *out = NULL; size_t len; - r = command (&amp...
2012 Aug 30
2
[PATCH v2] daemon: collect list of called external commands
...28,15 @@ #include "actions.h" #include "optgroups.h" +GUESTFSD_EXT_CMD(str_btrfs, btrfs); +GUESTFSD_EXT_CMD(str_btrfstune, btrfstune); +GUESTFSD_EXT_CMD(str_btrfsck, btrfsck); +GUESTFSD_EXT_CMD(str_mkfs_btrfs, mkfs.btrfs); + int optgroup_btrfs_available (void) { - return prog_exists ("btrfs") && filesystem_available ("btrfs") > 0; + return prog_exists (str_btrfs) && filesystem_available ("btrfs") > 0; } /* Takes optional arguments, consult optargs_bitmask. */ @@ -46,7 +51,7 @@ do_btrfs_filesystem_resize (const char *fil...
2012 Aug 30
1
[PATCH] collect list of called external commands
...10 +28,15 @@ #include "actions.h" #include "optgroups.h" +GUESTFS_EXT_CMD(str_btrfs, btrfs); +GUESTFS_EXT_CMD(str_btrfstune, btrfstune); +GUESTFS_EXT_CMD(str_btrfsck, btrfsck); +GUESTFS_EXT_CMD(str_mkfs_btrfs, mkfs.btrfs); + int optgroup_btrfs_available (void) { - return prog_exists ("btrfs") && filesystem_available ("btrfs") > 0; + return prog_exists (str_btrfs) && filesystem_available ("btrfs") > 0; } /* Takes optional arguments, consult optargs_bitmask. */ @@ -46,7 +51,7 @@ do_btrfs_filesystem_resize (const char *fil...
2017 Jul 14
0
[PATCH 06/27] daemon: Add unit tests of the ‘Utils’ module.
...cense for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +open Unix +open Printf + +open Utils + +(* Test prog_exists. *) +let () = + assert (prog_exists "ls"); + assert (prog_exists "true") + +(* Test command, commandr. *) +let () = + ignore (command "true" []); + + let r, _, _ = commandr "false" [] in + assert (r = 1) + +(* Test split_device_partition. *) +let () = +...
2017 Jul 27
3
[PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
This is a simpler patch that removes GUESTFSD_EXT_CMD completely.
2017 Jul 24
6
[PATCH 0/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.
Replace GUESTFSD_EXT_CMD with a command line option ‘./guestfsd --print-external-commands’
2015 Jan 14
2
[PATCH] daemon: use btrfs(1) to get btrfs labels
...return btrfs_get_label (mountable->device); + return get_blkid_tag (mountable->device, "LABEL"); } diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 150c089..cf1507d 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -44,6 +44,30 @@ optgroup_btrfs_available (void) return prog_exists (str_btrfs) && filesystem_available ("btrfs") > 0; } +char * +btrfs_get_label (const char *device) +{ + int r; + CLEANUP_FREE char *err = NULL; + char *out = NULL; + size_t len; + + r = command (&out, &err, str_btrfs, "filesystem", "label",...
2016 Mar 08
1
[PATCH] sleuthkit availability check renamed
...x 647d1e7..0fe1250 100644 --- a/daemon/tsk.c +++ b/daemon/tsk.c @@ -31,12 +31,12 @@ static int file_out (const char *cmd); -GUESTFSD_EXT_CMD(str_tsk_probe, icat); +GUESTFSD_EXT_CMD(str_sleuthkit_probe, icat); int -optgroup_icat_available (void) +optgroup_sleuthkit_available (void) { - return prog_exists (str_tsk_probe); + return prog_exists (str_sleuthkit_probe); } int diff --git a/generator/actions.ml b/generator/actions.ml index 51f2295..ff72cfe 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12949,7 +12949,7 @@ otherwise the call will fail." }; name = "icat&...
2010 Mar 26
1
[PATCH] appliance: Set $PATH instead of hard-coding paths to binaries everywhere.
...dev", switc, NULL, NULL, diff --git a/daemon/daemon.h b/daemon/daemon.h index 777cf33..19dd69c 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -70,6 +70,8 @@ extern void trim (char *str); extern int device_name_translation (char *device, const char *func); +extern int prog_exists (const char *prog); + extern void udev_settle (void); /* This just stops gcc from giving a warning about our custom diff --git a/daemon/ext2.c b/daemon/ext2.c index c90ee05..3758f4e 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -43,11 +43,11 @@ e2prog (char *name) p++; *p = '4&...
2016 Mar 29
0
[PATCH 1/2] rename icat API to download_inode
...clude "optgroups.h" -static int file_out (const char *cmd); +int optgroup_sleuthkit_available(void); +static int send_command_output(const char *cmd); -GUESTFSD_EXT_CMD(str_sleuthkit_probe, icat); +GUESTFSD_EXT_CMD(str_icat, icat); -int -optgroup_sleuthkit_available (void) -{ - return prog_exists (str_sleuthkit_probe); -} - -int -do_icat (const mountable_t *mountable, int64_t inode) +/* Has one FileOut parameter. */ +int do_download_inode(const mountable_t *mountable, int64_t inode) { CLEANUP_FREE char *cmd = NULL; /* Inode must be greater than 0 */ if (inode < 0) { - repl...
2015 Jan 15
1
[PATCH 2/2] daemon: use ntfslabel(1) to get ntfs labels
...+33,7 @@ GUESTFSD_EXT_CMD(str_ntfs3g_probe, ntfs-3g.probe); GUESTFSD_EXT_CMD(str_ntfsresize, ntfsresize); GUESTFSD_EXT_CMD(str_ntfsfix, ntfsfix); +GUESTFSD_EXT_CMD(str_ntfslabel, ntfslabel); int optgroup_ntfs3g_available (void) @@ -46,6 +47,29 @@ optgroup_ntfsprogs_available (void) return prog_exists (str_ntfsresize); } +char * +ntfs_get_label (const char *device) +{ + int r; + CLEANUP_FREE char *err = NULL; + char *out = NULL; + size_t len; + + r = command (&out, &err, str_ntfslabel, device, NULL); + if (r == -1) { + reply_with_error ("%s", err); + free (out);...
2012 Jul 09
1
[PATCH] NEW API: add new api xfs_info
...+#include <stdlib.h> +#include <inttypes.h> +#include <string.h> +#include <unistd.h> + +#include "guestfs_protocol.h" +#include "daemon.h" +#include "c-ctype.h" +#include "actions.h" + +int +optgroup_xfs_available (void) +{ + return prog_exists ("mkfs.xfs"); +} + +char * +do_xfs_info (const char *path) +{ + int r; + char *buf; + char *out, *err; + + if (do_is_dir (path)) { + buf = sysroot_path (path); + if (!buf) { + reply_with_perror ("malloc"); + return NULL; + } + } else { + buf = strdup(...
2016 Mar 29
2
[PATCH] renamed daemon/tsk.c to daemon/sleuthkit.c
...unistd.h> + +#include "guestfs_protocol.h" +#include "daemon.h" +#include "actions.h" +#include "optgroups.h" + +static int file_out (const char *cmd); + +GUESTFSD_EXT_CMD(str_sleuthkit_probe, icat); + +int +optgroup_sleuthkit_available (void) +{ + return prog_exists (str_sleuthkit_probe); +} + +int +do_icat (const mountable_t *mountable, int64_t inode) +{ + CLEANUP_FREE char *cmd = NULL; + + /* Inode must be greater than 0 */ + if (inode < 0) { + reply_with_error ("inode must be >= 0"); + return -1; + } + + /* Construct the command....
2016 Mar 29
3
[PATCH 0/2] rename icat API as download_inode
"icat" name comes from the employed command line tool which might be replaced later on with a different implementation. The command name is a bit confusing because it's similar to "cat" but act as "donwload". Therefore I am renaming it with a more clear name. At the same time I cleaned up a bit the code and improved it's readability and code comments. This
2016 Mar 30
4
[PATCH 0/3] rename icat API into download_inode
The command name is a bit confusing because it's similar to "cat" but act as "donwload". Therefore I am renaming it with a more clear name. At the same go I cleaned up a bit the code following the standards and improved the API documentation. This patch is ready for review. Code available at: https://github.com/noxdafox/libguestfs/tree/download_inode Matteo Cafasso (3):
2017 Mar 20
2
[PATCH] daemon: selinux: Add setfiles -m option to suppress extra excludes (RHBZ#1433577).
...label.c +++ b/daemon/selinux-relabel.c @@ -27,6 +27,8 @@ #include "actions.h" #include "optgroups.h" +#include "ignore-value.h" + GUESTFSD_EXT_CMD(str_setfiles, setfiles); #define MAX_ARGS 64 @@ -37,6 +39,20 @@ optgroup_selinuxrelabel_available (void) return prog_exists (str_setfiles); } +static int +setfiles_has_m_option (void) +{ + static int flag = -1; + CLEANUP_FREE char *err = NULL; + + if (flag == -1) { + ignore_value (command (NULL, &err, str_setfiles, "-m", NULL)); + flag = err && strstr (err, /* "invalid option -- &...
2017 Apr 12
0
Re: [PATCH 1/2] daemon: run 'udevadm settle' with --exit-if-exists option
...insertions(+), 4 deletions(-) > > diff --git a/daemon/daemon.h b/daemon/daemon.h > index 79a5288f6..90ebaafbe 100644 > --- a/daemon/daemon.h > +++ b/daemon/daemon.h > @@ -141,6 +141,8 @@ extern int parse_btrfsvol (const char *desc, mountable_t *mountable); > > extern int prog_exists (const char *prog); > > +extern void udev_settle_file (const char *file); > + > extern void udev_settle (void); > > extern int random_name (char *template); > diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c > index 85ce5d2ad..dccfa15bc 100644 > --- a/daemon/gues...