X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fswap.c;h=51dbbe483f6748ae0508a622d5998d6b38d6ff87;hb=34c0542189a443e57f2b09886f31b5bdad404bbf;hp=5de6ba61c718927779c0a8f769d53191b58d5c95;hpb=52f9cd4882135910ea06e1e50ac6441d455c9ab1;p=libguestfs.git diff --git a/daemon/swap.c b/daemon/swap.c index 5de6ba6..51dbbe4 100644 --- a/daemon/swap.c +++ b/daemon/swap.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 @@ -23,11 +23,13 @@ #include #include -#include "../src/guestfs_protocol.h" +#include "guestfs_protocol.h" #include "daemon.h" #include "actions.h" #include "optgroups.h" +#include "ignore-value.h" + /* Confirmed this is true for Linux swap partitions from the Linux sources. */ #define SWAP_LABEL_MAX 16 @@ -41,8 +43,13 @@ optgroup_linuxfsuuid_available (void) char *err; int av; - /* Ignore return code - mkswap --help *will* fail. */ - command (NULL, &err, "mkswap", "--help", NULL); + /* Upstream util-linux have been gradually changing '--help' to go + * from stderr to stdout, and changing the return code from 1 to 0. + * Thus we need to fold stdout and stderr together, and ignore the + * return code. + */ + ignore_value (commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + "mkswap", "--help", NULL)); av = strstr (err, "-U") != NULL; free (err);