-rw-r--r-- | core/apps/textedit/textedit.cpp | 9 | ||||
-rw-r--r-- | core/launcher/packageslave.cpp | 30 |
2 files changed, 22 insertions, 17 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 4bbc62b..1c81a55 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -788,3 +788,2 @@ bool TextEdit::save() { | |||
788 | } | 788 | } |
789 | name = currentFileName; | ||
790 | if(doc) { | 789 | if(doc) { |
@@ -809,3 +808,4 @@ bool TextEdit::save() { | |||
809 | mode_t mode; | 808 | mode_t mode; |
810 | stat(file.latin1(), &buf); | 809 | QFile f(file); |
810 | fstat(f.handle(), &buf); | ||
811 | mode = buf.st_mode; | 811 | mode = buf.st_mode; |
@@ -821,3 +821,2 @@ bool TextEdit::save() { | |||
821 | odebug << "regular save file" << oendl; | 821 | odebug << "regular save file" << oendl; |
822 | QFile f(file); | ||
823 | if( f.open(IO_WriteOnly)) { | 822 | if( f.open(IO_WriteOnly)) { |
@@ -829,3 +828,2 @@ bool TextEdit::save() { | |||
829 | } | 828 | } |
830 | |||
831 | } | 829 | } |
@@ -837,4 +835,3 @@ bool TextEdit::save() { | |||
837 | 835 | ||
838 | 836 | fchmod( f.handle(), mode); | |
839 | chmod( file.latin1(), mode); | ||
840 | } | 837 | } |
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index abbc610..965020e 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp | |||
@@ -222,14 +222,21 @@ void PackageHandler::cleanupPackageFiles( const QString &listfile ) | |||
222 | // for s, do link/mkdir. | 222 | // for s, do link/mkdir. |
223 | if ( s.right(1) == "/" ) { | 223 | // @todo Right now we just move on if the name of the file we |
224 | //should rmdir if empty, after all files have been removed | 224 | // find is actually a directory. What we ought to do is check |
225 | } else { | 225 | // to see if the directory is empty and if so remove it. |
226 | if ( s.right(1) != "/" ) { | ||
226 | #ifndef Q_OS_WIN32 | 227 | #ifndef Q_OS_WIN32 |
227 | odebug << "remove symlink for " << s.ascii() << "" << oendl; | 228 | odebug << "remove symlink for " << s << oendl; |
229 | QFile symFile(s); | ||
230 | QFileInfo symFileInfo(symFile); | ||
228 | //check if it is a symlink first (don't remove /etc/passwd...) | 231 | //check if it is a symlink first (don't remove /etc/passwd...) |
229 | char buf[10]; //we don't care about the contents | 232 | if ( !symFileInfo.readLink().isNull()) |
230 | if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) | 233 | if (!symFile.remove()) |
231 | ::unlink( s.ascii() ); | 234 | owarn << "Unable to remove symlink " << symFile.name() |
235 | << " " << __FILE__ << ":" << __LINE__ << oendl; | ||
232 | #else | 236 | #else |
233 | // ### revise | 237 | // @todo If we actually want to be portable to other operating |
234 | owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl; | 238 | // systems we ought to at least have a portable way of removing |
239 | // their notion of symlinks. | ||
240 | owarn << "Unable to remove symlink " << s " " << __FILE__ | ||
241 | << ":" << __LINE__ << oendl; | ||
235 | #endif | 242 | #endif |
@@ -240,4 +247,5 @@ void PackageHandler::cleanupPackageFiles( const QString &listfile ) | |||
240 | //remove the list file | 247 | //remove the list file |
241 | ::unlink( listfile.ascii() ); | 248 | if (!f.remove()) |
242 | 249 | owarn << "Unable to remove list file " << f.name() << " " | |
250 | << __FILE__ << ":" << __LINE__ << oendl; | ||
243 | } | 251 | } |