summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-03-29 11:33:31 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-03-29 11:33:31 +0100
commit45903de1b5a8125c86254e2f712bc4f2d3a9f462 (patch)
tree71c18caffe016a3bbff44470f2223294cbed35c1
parentd02591d45c5b059e1d072640add45d8bd3dc2026 (diff)
QPhotoRec: handle no space left and non-writable destination
-rw-r--r--src/qphotorec.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/qphotorec.cpp b/src/qphotorec.cpp
index 75c4bf0..b55e222 100644
--- a/src/qphotorec.cpp
+++ b/src/qphotorec.cpp
@@ -792,6 +792,40 @@ int QPhotorec::photorec(alloc_data_t *list_search_space)
session_save(list_search_space, params, options);
switch(ind_stop)
{
+ case PSTATUS_EACCES:
+ {
+ int ret=QMessageBox::warning(this,"QPhotoRec: Failed to create file!", "Failed to create file! Please choose another destination", QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok);
+ if(ret==QMessageBox::Cancel)
+ {
+ params->status=STATUS_QUIT;
+ }
+ else
+ {
+ setExistingDirectory();
+ free(params->recup_dir);
+ QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
+ params->recup_dir=strdup(byteArray.constData());
+ params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
+ }
+ }
+ break;
+ case PSTATUS_ENOSPC:
+ {
+ int ret=QMessageBox::warning(this,"QPhotoRec: Not enough space!", "There is not enough space left! Please free disk space and/or choose another destination", QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok);
+ if(ret==QMessageBox::Cancel)
+ {
+ params->status=STATUS_QUIT;
+ }
+ else
+ {
+ setExistingDirectory();
+ free(params->recup_dir);
+ QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
+ params->recup_dir=strdup(byteArray.constData());
+ params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
+ }
+ }
+break;
case PSTATUS_OK:
status_inc(params, options);
if(params->status==STATUS_QUIT)