From 01f71fcc6eca0e0fbd38ed48f8c2d2ea83bebfd1 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Tue, 7 Apr 2009 14:32:54 -1000 Subject: Run /bin/umount instead of calling umount(2) in _isys.umount (#493333) Call the umount(8) command when unmounting filesystems through isys so that /etc/mtab is updated. --- isys/isys.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'isys') diff --git a/isys/isys.c b/isys/isys.c index bd68f8fbb..8a83a546b 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -1,7 +1,7 @@ /* * isys.c * - * Copyright (C) 2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Red Hat, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,6 @@ #undef dev_t #define dev_t dev_t #include -#include #include #include #include @@ -262,13 +261,33 @@ static PyObject * doLoSetup(PyObject * s, PyObject * args) { } static PyObject * doUMount(PyObject * s, PyObject * args) { - char * fs; + char *err = NULL, *mntpoint = NULL; + int rc; - if (!PyArg_ParseTuple(args, "s", &fs)) return NULL; + if (!PyArg_ParseTuple(args, "s", &mntpoint)) { + return NULL; + } - if (umount(fs)) { - PyErr_SetFromErrno(PyExc_SystemError); - return NULL; + rc = doPwUmount(mntpoint, &err); + if (rc == IMOUNT_ERR_ERRNO) { + PyErr_SetFromErrno(PyExc_SystemError); + } else if (rc) { + PyObject *tuple = PyTuple_New(2); + + PyTuple_SetItem(tuple, 0, PyInt_FromLong(rc)); + + if (err == NULL) { + Py_INCREF(Py_None); + PyTuple_SetItem(tuple, 1, Py_None); + } else { + PyTuple_SetItem(tuple, 1, PyString_FromString(err)); + } + + PyErr_SetObject(PyExc_SystemError, tuple); + } + + if (rc) { + return NULL; } Py_INCREF(Py_None); -- cgit