summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-07-28 04:04:02 (UTC)
committer llornkcor <llornkcor>2004-07-28 04:04:02 (UTC)
commit3237660c06d9920e4323cf6f1ea624a4f102892d (patch) (side-by-side diff)
treef8f1f3adfb4d42b2f9ca1ddfd2b87a7a0664970d
parente98e9106df225b9e19a45a6f0e44193b1d018461 (diff)
downloadopie-3237660c06d9920e4323cf6f1ea624a4f102892d.zip
opie-3237660c06d9920e4323cf6f1ea624a4f102892d.tar.gz
opie-3237660c06d9920e4323cf6f1ea624a4f102892d.tar.bz2
use safer method to set file perms after copy
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index d34f330..4628170 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -540,50 +540,50 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
}
write_fd = destFile.handle();
if(write_fd != -1) {
err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
if( err == -1) {
QString msg;
switch(err) {
case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
case EINVAL: msg = "Descriptor is not valid or locked. ";
case ENOMEM: msg = "Insufficient memory to read from in_fd.";
case EIO: msg = "Unspecified error while reading from in_fd.";
};
success = false;
// owarn << msg << oendl;
}
} else {
success = false;
}
} else {
success = false;
}
srcFile.close();
destFile.close();
// Set file permissions
- if( stat( (const char *) src, &status ) == 0 ) {
- chmod( (const char *) dest, status.st_mode );
+ if( stat( QFile::encodeName(src), &status ) == 0 ) {
+ chmod( QFile::encodeName(dest), status.st_mode );
}
return success;
}
void AdvancedFm::runCommand() {
if( !CurrentView()->currentItem()) return;
QDir *thisDir = CurrentDir();
QString curFile;
curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
fileDlg->setInputText(curFile);
fileDlg->exec();
//QString command;
if( fileDlg->result() == 1 ) {
// odebug << fileDlg->LineEdit1->text() << oendl;
QStringList command;
command << "/bin/sh";
command << "-c";