[gnome-disk-utility] Verify that the file passed to --restore-disk-image is a regular file
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Verify that the file passed to --restore-disk-image is a regular file
- Date: Tue, 4 Jun 2013 02:33:45 +0000 (UTC)
commit 6b8997f78570b2bc9b4985364f44ebfa185669c0
Author: David Zeuthen <zeuthen gmail com>
Date: Mon Jun 3 19:33:31 2013 -0700
Verify that the file passed to --restore-disk-image is a regular file
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gduapplication.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/disks/gduapplication.c b/src/disks/gduapplication.c
index 612e969..4d0938a 100644
--- a/src/disks/gduapplication.c
+++ b/src/disks/gduapplication.c
@@ -129,14 +129,14 @@ gdu_application_object_from_block_device (GduApplication *app,
if (stat (block_device, &statbuf) != 0)
{
- *error_message = g_strdup_printf (_("Error opening %s: %s\n"), block_device, g_strerror (errno));
+ *error_message = g_strdup_printf (_("Error opening %s: %s"), block_device, g_strerror (errno));
goto out;
}
block = udisks_client_get_block_for_dev (app->client, statbuf.st_rdev);
if (block == NULL)
{
- *error_message = g_strdup_printf (_("Error looking up block device for %s\n"), block_device);
+ *error_message = g_strdup_printf (_("Error looking up block device for %s"), block_device);
goto out;
}
@@ -227,12 +227,23 @@ gdu_application_command_line (GApplication *_app,
object_to_select = gdu_application_object_from_block_device (app, opt_block_device, &error_message);
if (object_to_select == NULL)
{
- g_application_command_line_print (command_line, "%s", error_message);
+ g_application_command_line_printerr (command_line, "%s\n", error_message);
g_free (error_message);
goto out;
}
}
+ if (opt_restore_disk_image != NULL)
+ {
+ if (!g_file_test (opt_restore_disk_image, G_FILE_TEST_IS_REGULAR))
+ {
+ g_application_command_line_printerr (command_line,
+ "%s does not appear to be a regular file\n",
+ opt_restore_disk_image);
+ goto out;
+ }
+ }
+
if (opt_xid == -1)
{
if (app->window == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]