X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Freopen.c;h=585bbd231204a385b7ead89aba27b7bc412ee560;hp=2dfc8db6f8d36f8929dd6729624b141bd94cc774;hb=cd077b8229731e292798f34dd56892cbfa6f1e0e;hpb=a96d70113ffcd01f55262c3d0fbe711bee759fec diff --git a/fish/reopen.c b/fish/reopen.c index 2dfc8db..585bbd2 100644 --- a/fish/reopen.c +++ b/fish/reopen.c @@ -13,7 +13,7 @@ * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -26,11 +26,13 @@ #include "fish.h" int -do_reopen (const char *cmd, int argc, char *argv[]) +run_reopen (const char *cmd, size_t argc, char *argv[]) { guestfs_h *g2; int r; const char *p; + guestfs_error_handler_cb cb; + void *cb_data; if (argc > 0) { fprintf (stderr, _("'reopen' command takes no parameters\n")); @@ -50,6 +52,9 @@ do_reopen (const char *cmd, int argc, char *argv[]) /* Now copy some of the settings from the old handle. The settings * we copy are those which are set by guestfish itself. */ + cb = guestfs_get_error_handler (g, &cb_data); + guestfs_set_error_handler (g2, cb, cb_data); + r = guestfs_get_verbose (g); if (r >= 0) guestfs_set_verbose (g2, r); @@ -66,9 +71,24 @@ do_reopen (const char *cmd, int argc, char *argv[]) if (p) guestfs_set_path (g2, p); + r = guestfs_get_pgroup (g); + if (r >= 0) + guestfs_set_pgroup (g2, r); + + if (progress_bars) + guestfs_set_event_callback (g2, progress_callback, + GUESTFS_EVENT_PROGRESS, 0, NULL); + /* Close the original handle. */ guestfs_close (g); g = g2; + /* We don't bother copying event handlers over to the new handle, + * but we have to reset the list because they were registered + * against the old handle. + */ + free_event_handlers (); + init_event_handlers (); + return 0; }