diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-07-21 13:21:43 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-07-21 14:26:24 +0100 |
commit | fa3b204f4a672bed859cf9e8ea0b0c8c9e3542d2 (patch) | |
tree | 52b919e0675c84276bc379fa5abd83d76a7c2231 /src/launch-appliance.c | |
parent | a58368b3db4f02b9fd907cec82621be11884d256 (diff) | |
download | libguestfs-fa3b204f4a672bed859cf9e8ea0b0c8c9e3542d2.tar.gz libguestfs-fa3b204f4a672bed859cf9e8ea0b0c8c9e3542d2.tar.xz libguestfs-fa3b204f4a672bed859cf9e8ea0b0c8c9e3542d2.zip |
appliance: Push appliance building lock into guestfs___build_appliance.
Since we will be calling guestfs___build_appliance from the libvirt
code in future, there's no point having two places where we have to
acquire the lock. Push the lock down into this function instead.
Because "glthread/lock.h" includes <errno.h> we have to add this
header to the file too.
Diffstat (limited to 'src/launch-appliance.c')
-rw-r--r-- | src/launch-appliance.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/launch-appliance.c b/src/launch-appliance.c index 79eae348..f10801c3 100644 --- a/src/launch-appliance.c +++ b/src/launch-appliance.c @@ -23,13 +23,12 @@ #include <stdint.h> #include <inttypes.h> #include <unistd.h> +#include <errno.h> #include <fcntl.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> -#include "glthread/lock.h" - #include "guestfs.h" #include "guestfs-internal.h" #include "guestfs-internal-actions.h" @@ -121,13 +120,6 @@ add_cmdline_shell_unquoted (guestfs_h *g, const char *options) } } -/* RHBZ#790721: It makes no sense to have multiple threads racing to - * build the appliance from within a single process, and the code - * isn't safe for that anyway. Therefore put a thread lock around - * appliance building. - */ -gl_lock_define_initialized (static, building_lock); - static int launch_appliance (guestfs_h *g, const char *arg) { @@ -150,12 +142,8 @@ launch_appliance (guestfs_h *g, const char *arg) /* Locate and/or build the appliance. */ char *kernel = NULL, *initrd = NULL, *appliance = NULL; - gl_lock_lock (building_lock); - if (guestfs___build_appliance (g, &kernel, &initrd, &appliance) == -1) { - gl_lock_unlock (building_lock); + if (guestfs___build_appliance (g, &kernel, &initrd, &appliance) == -1) return -1; - } - gl_lock_unlock (building_lock); TRACE0 (launch_build_appliance_end); |