From 93300e2b328c9bd8b715f6cecfebf143bd270d70 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Wed, 14 Dec 2005 15:15:51 +0000 Subject: [PATCH] use mkdir instead of wrapping CLI tool * include/FileSystem.h, src/jfs.cc, src/xfs.cc: use mkdir instead of wrapping CLI tool --- ChangeLog | 6 ++++++ include/FileSystem.h | 1 + src/jfs.cc | 4 ++-- src/xfs.cc | 11 +++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index abb8c6c6..b475c31a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-12-14 Bart Hakvoort + + * include/FileSystem.h, + src/jfs.cc, + src/xfs.cc: use mkdir instead of wrapping CLI tool + 2005-12-14 Bart Hakvoort * include/Utils.h, diff --git a/include/FileSystem.h b/include/FileSystem.h index 49180865..0660f091 100644 --- a/include/FileSystem.h +++ b/include/FileSystem.h @@ -25,6 +25,7 @@ #include #include +#include namespace GParted { diff --git a/src/jfs.cc b/src/jfs.cc index 166107ac..7ae7be65 100644 --- a/src/jfs.cc +++ b/src/jfs.cc @@ -103,13 +103,13 @@ bool jfs::Resize( const Partition & partition_new, bool fill_partition ) Glib::ustring TEMP_MP = "/tmp/gparted_tmp_jfs_mountpoint" ; //jfs kan only grow if the partition is mounted.. - system( ("mkdir " + TEMP_MP) .c_str() ) ; + mkdir( TEMP_MP .c_str(), 0 ) ; if ( Utils::mount( partition_new .partition, TEMP_MP, "jfs", error ) ) { return_value = Utils::mount( partition_new .partition, TEMP_MP, "jfs", error, MS_REMOUNT, "resize" ) ; Utils::unmount( partition_new .partition, TEMP_MP, error ) ; } - system( ("rmdir " + TEMP_MP) .c_str() ) ; + rmdir( TEMP_MP .c_str() ) ; return return_value ; } diff --git a/src/xfs.cc b/src/xfs.cc index cebfd6f4..5b76d903 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -100,13 +100,13 @@ bool xfs::Resize( const Partition & partition_new, bool fill_partition ) Glib::ustring TEMP_MP = "/tmp/gparted_tmp_xfs_mountpoint" ; //xfs kan only grow if the partition is mounted.. - system( ("mkdir " + TEMP_MP) .c_str() ) ; + mkdir( TEMP_MP .c_str(), 0 ) ; if ( Utils::mount( partition_new .partition, TEMP_MP, "xfs", error ) ) { return_value = ! Execute_Command( "xfs_growfs " + TEMP_MP ) ; Utils::unmount( partition_new .partition, TEMP_MP, error ) ; } - system( ("rmdir " + TEMP_MP) .c_str() ) ; + rmdir( TEMP_MP .c_str() ) ; return return_value ; } @@ -118,7 +118,8 @@ bool xfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_ Glib::ustring SRC = "/tmp/gparted_tmp_xfs_src_mountpoint" ; Glib::ustring DST = "/tmp/gparted_tmp_xfs_dest_mountpoint" ; - system( ("mkdir " + SRC + " " + DST) .c_str() ) ; + mkdir( SRC .c_str(), 0 ) ; + mkdir( DST .c_str(), 0 ) ; if ( ! Execute_Command( "mkfs.xfs -f " + dest_part_path ) && Utils::mount( src_part_path, SRC, "xfs", error, MS_NOATIME | MS_RDONLY ) && @@ -128,8 +129,10 @@ bool xfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_ Utils::unmount( src_part_path, SRC, error ) ; Utils::unmount( dest_part_path, DST, error ) ; - system( ("rmdir " + SRC + " " + DST) .c_str() ) ; + rmdir( SRC .c_str() ) ; + rmdir( DST .c_str() ) ; + return return_value ; }