libreport/0001-don-t-try-to-delete-dump-dir-which-doesn-t-exist-rhb.patch

59 lines
1.7 KiB
Diff
Raw Normal View History

From a4a6498eea98356b1580411136e57c7518a58b79 Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Mon, 6 Aug 2012 16:43:23 +0200
Subject: [PATCH 1/2] don't try to delete dump dir which doesn't exist
rhbz#799909
---
po/POTFILES.in | 1 +
src/lib/abrt_sock.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 118ca80..c991817 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,6 +10,7 @@ src/gtk-helpers/secrets.c
src/gui-wizard-gtk/main.c
src/gui-wizard-gtk/wizard.c
src/gui-wizard-gtk/wizard.glade
+src/lib/abrt_sock.c
src/lib/create_dump_dir.c
src/lib/event_config.c
src/lib/parse_options.c
diff --git a/src/lib/abrt_sock.c b/src/lib/abrt_sock.c
index b2c9928..b595208 100644
--- a/src/lib/abrt_sock.c
+++ b/src/lib/abrt_sock.c
@@ -53,7 +53,7 @@ static int connect_to_abrtd_and_call_DeleteDebugDump(const char *dump_dir_name)
}
else
{
- perror_msg("Can't connect to '%s'", SOCKET_FILE);
+ VERB1 perror_msg("Can't connect to '%s'", SOCKET_FILE);
}
close(socketfd);
@@ -70,7 +70,17 @@ int delete_dump_dir_possibly_using_abrtd(const char *dump_dir_name)
return dd_delete(dd);
dd_close(dd);
}
+ else
+ {
+ if (errno == ENOENT || errno == ENOTDIR)
+ /* No such dir, no point in trying to talk over socket */
+ return 1;
+ }
VERB1 log("Deleting '%s' via abrtd", dump_dir_name);
- return connect_to_abrtd_and_call_DeleteDebugDump(dump_dir_name);
+ const int res = connect_to_abrtd_and_call_DeleteDebugDump(dump_dir_name);
+ if (res != 0)
+ error_msg(_("Can't delete: '%s'"), dump_dir_name);
+
+ return res;
}
--
1.7.11.2