summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2006-06-26 21:37:06 +0000
committerRoger Leigh <rleigh@debian.org>2006-06-26 21:37:06 +0000
commit934673faadba1318e191658041656a921e38cf3c (patch)
tree4341efae74ba73487b53860b7777239f1ba15c09
parentc7a6a4a3cdc2bc6fe75a9290c9282e3e6955d5ab (diff)
downloadschroot-934673faadba1318e191658041656a921e38cf3c.tar.gz
* sbuild/sbuild-session.cc (is_group_member): Rather than exiting
with failure status, warn and return false, or throw an exception.
-rw-r--r--ChangeLog5
-rw-r--r--TODO5
-rw-r--r--sbuild/sbuild-session.cc18
3 files changed, 10 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index a5ab1c7b..4475c594 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2006-06-26 Roger Leigh <rleigh@debian.org>
+ * sbuild/sbuild-session.cc (is_group_member): Rather than exiting
+ with failure status, warn and return false, or throw an exception.
+
+2006-06-26 Roger Leigh <rleigh@debian.org>
+
* debian/schroot.docs: Add. Include THANKS.
2006-06-26 Roger Leigh <rleigh@debian.org>
diff --git a/TODO b/TODO
index b088b8c8..b9472cfb 100644
--- a/TODO
+++ b/TODO
@@ -11,11 +11,6 @@ PENDING
* Update documentation schroot.conf examples.
-* sbuild-session unnnamed namespace helper routines shouldn't exit
-
- They should throw an exception instead. Need to check suitable
- catch blocks are in place.
-
* Review quoting style.
Use of single and double quotes in strings is inconsistent. Needs
diff --git a/sbuild/sbuild-session.cc b/sbuild/sbuild-session.cc
index fed09b10..c62fd7e3 100644
--- a/sbuild/sbuild-session.cc
+++ b/sbuild/sbuild-session.cc
@@ -123,14 +123,14 @@ namespace
if (errno == 0)
{
session::error e(group, session::GROUP_UNKNOWN);
- log_error() << e.what() << endl;
+ log_warning() << e.what() << endl;
}
else
{
session::error e(group, session::GROUP_UNKNOWN, errno);
- log_error() << e.what() << endl;
+ log_warning() << e.what() << endl;
}
- exit (EXIT_FAILURE);
+ return false;
}
bool group_member = false;
@@ -142,20 +142,12 @@ namespace
{
int supp_group_count = getgroups(0, NULL);
if (supp_group_count < 0)
- {
- session::error e(session::GROUP_GET_SUPC, errno);
- log_error() << e.what() << endl;
- exit (EXIT_FAILURE);
- }
+ throw session::error(session::GROUP_GET_SUPC, errno);
if (supp_group_count > 0)
{
gid_t *supp_groups = new gid_t[supp_group_count];
if (getgroups(supp_group_count, supp_groups) < 1)
- {
- session::error e(session::GROUP_GET_SUP, errno);
- log_error() << e.what() << endl;
- exit (EXIT_FAILURE);
- }
+ throw session::error(session::GROUP_GET_SUP, errno);
for (int i = 0; i < supp_group_count; ++i)
{