2008-08-05
2008-08-05 22:15:44 by Martin Stjernholm <mast@lysator.liu.se>
-
d307c75238052a209b6d11db0b0fd0d7cadd436b
(117 lines)
(+71/-46)
[
Show
| Annotate
]
Branch: 5.2
Fixed a lot of catches that sloppily throws away the errors. Many
still remains, though.
Rev: server/base_server/roxen.pike:1.979
6:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.
// ABS and suicide systems contributed freely by Francesco Chemolli
- constant cvs_version="$Id: roxen.pike,v 1.978 2008/07/01 19:44:20 grubba Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.979 2008/08/05 22:15:44 mast Exp $";
//! @appears roxen
//!
126: Inside #if defined(THREADS)
void name_thread( object thread, string name )
{
- catch(thread->set_name( name ));
+
thread_names[ sprintf( "%O", thread ) ] = name;
}
194: Inside #if defined(HAVE_EFFECTIVE_USER) and #if defined(THREADS)
#ifdef THREADS
if (euid_egid_lock) {
- catch { mutex_key = euid_egid_lock->lock(); };
+ if (mixed err = catch { mutex_key = euid_egid_lock->lock(); })
+ werror (describe_backtrace (err));
}
threads_disabled = _disable_threads();
#endif /* THREADS */
254: Inside #if defined(HAVE_EFFECTIVE_USER)
if (u[2]) {
#if efun(cleargroups)
- catch { cleargroups(); };
+ if (mixed err = catch { cleargroups(); })
+ werror (describe_backtrace (err));
#endif /* cleargroups */
#if efun(initgroups)
- catch { initgroups(u[0], u[3]); };
+ if (mixed err = catch { initgroups(u[0], u[3]); })
+ werror (describe_backtrace (err));
#endif
}
gid = gid || getgid();
340: Inside #if defined(HAVE_EFFECTIVE_USER)
privs_level = p_level;
if(LOGP) {
- catch {
+ if (mixed err = catch {
array bt = backtrace();
if (sizeof(bt) >= 2) {
report_notice(LOC_M(3,"Change back to uid#%d gid#%d, from %s")+"\n",
349: Inside #if defined(HAVE_EFFECTIVE_USER)
report_notice(LOC_M(4,"Change back to uid#%d gid#%d, "
"from backend")+"\n", saved_uid, saved_gid);
}
- };
+ })
+ werror (describe_backtrace (err));
}
#ifdef PRIVS_DEBUG
370: Inside #if defined(HAVE_EFFECTIVE_USER)
seteuid(0);
array u = getpwuid(saved_uid);
#if efun(cleargroups)
- catch { cleargroups(); };
+ if (mixed err = catch { cleargroups(); })
+ werror (describe_backtrace (err));
#endif /* cleargroups */
if(u && (sizeof(u) > 3)) {
- catch { initgroups(u[0], u[3]); };
+ if (mixed err = catch { initgroups(u[0], u[3]); })
+ werror (describe_backtrace (err));
}
setegid(saved_gid);
seteuid(saved_uid);
440:
{
// Die nicely. Catch for paranoia reasons
#ifdef THREADS
- catch (stop_handler_threads());
+ if (mixed err = catch (stop_handler_threads()))
+ werror (describe_backtrace (err));
#endif /* THREADS */
if (!exit_code || once_mode) {
// We're shutting down; Attempt to take mysqld with us.
- catch { report_notice("Shutting down MySQL.\n"); };
+ if (mixed err =
+ catch { report_notice("Shutting down MySQL.\n"); } ||
catch {
- Sql.sql db = connect_to_my_mysql(0, "mysql");
+ Sql.Sql db = connect_to_my_mysql(0, "mysql");
db->shutdown();
- };
+ })
+ werror (describe_backtrace (err));
}
destruct (cache);
#if 0
// Disabled since it's lying when the server is shut down with a
// SIGTERM or SIGINT to the start script (which include the stop
// action of the init.d script).
- catch {
+ if (mixed err = catch {
if (exit_code && !once_mode)
report_notice("Restarting Roxen.\n");
else
report_notice("Shutting down Roxen.\n");
- };
+ })
+ werror (describe_backtrace (err));
#endif
roxenloader.real_exit( exit_code ); // Now we die...
}
474:
{
if(_recurse >= 4)
{
- catch (report_notice("Exiting roxen (spurious signals received).\n"));
- catch (stop_all_configurations());
+ if (mixed err =
+ catch (report_notice("Exiting roxen (spurious signals received).\n")) ||
+ catch (stop_all_configurations()))
+ werror (describe_backtrace (err));
destruct(cache);
#ifdef THREADS
- catch (stop_handler_threads());
+ if (mixed err = catch (stop_handler_threads()))
+ werror (describe_backtrace (err));
#endif /* THREADS */
roxenloader.real_exit(exit_code);
}
if (_recurse++) return;
- catch(stop_all_configurations());
+ if (mixed err = catch(stop_all_configurations()))
+ werror (describe_backtrace (err));
#ifdef SNMP_AGENT
if(objectp(snmpagent)) {
2786: Inside #if undefined(__NT__) and #if defined(THREADS)
int t = alarm(20);
#ifdef THREADS
report_debug("Handler queue:\n");
- catch {
+ if (mixed err = catch {
array(mixed) queue = handle_queue->buffer[handle_queue->r_ptr..];
foreach(queue, mixed v) {
if (!v) continue;
2796: Inside #if undefined(__NT__) and #if defined(THREADS)
report_debug(" %{%O, %}\n", v/({}));
}
}
- };
+ })
+ werror (describe_backtrace (err));
#endif
report_debug("Trying to dump backlog: \n");
- catch {
+ if (mixed err = catch {
// Catch for paranoia reasons.
describe_all_threads();
- };
+ })
+ werror (describe_backtrace (err));
low_engage_abs();
}
3608:
// Case 1: We have cache entry and image.
string f = q[0]->data;
mapping m;
- catch( m = decode_value( q[0]->meta ) );
+ if (mixed err = catch( m = decode_value( q[0]->meta ) ))
+ report_debug ("Failed to decode meta mapping for id %O in %s: %s",
+ id, name, describe_error (err));
if( !m ) return 0;
m = Roxen.http_string_answer( f, m->type||("image/gif") );
3921:
Thread.Mutex mutex = Thread.Mutex();
// Allow recursive locks, since it's normal here.
- # define LOCK() mixed __; catch( __ = mutex->lock() )
+ # define LOCK() mixed __ = mutex->lock (2)
#ifdef ARGCACHE_DEBUG
#define dwerror(ARGS...) werror(ARGS)
4199:
if(s == "EOF")
return 0;
array a;
- if(catch {
+ if(mixed err = catch {
a = decode_value(MIME.decode_base64(s));
- }) return "Decode failed for argcache record\n";
+ }) return "Decode failed for argcache record: " + describe_error (err);
if(sizeof(a) == 4) {
// Old style argcache dump.
4450: Inside #if defined(THREADS)
if (!from_handler_thread) {
// If this is necessary from every handler thread, these
// things are thread local and thus are no locks necessary.
- catch { mutex_key = euid_egid_lock->lock(); };
+ if (mixed err = catch { mutex_key = euid_egid_lock->lock(); })
+ werror (describe_backtrace (err));
threads_disabled = _disable_threads();
}
#endif
4460:
#endif
#if constant(initgroups)
- catch {
+ if (mixed err = catch {
initgroups(pw[0], gid);
// Doesn't always work - David.
- };
+ })
+ werror (describe_backtrace (err));
#endif
if (query("permanent_uid")) {
4727:
// file=Stdio.File();
// if(!file->open(f,"r") || !(data=file->read()))
#ifdef THREADS
- catch
+ if (mixed err = catch
{
string host = "";
sscanf( f, "http://%[^/]", host );
4739: Inside #if defined(THREADS)
"Host":host,
]);
data = Protocols.HTTP.get_url_data( f, 0, hd );
- };
+ })
+ werror (describe_backtrace (err));
#endif
if( !data )
return 0;
4766:
// file=Stdio.File();
// if(!file->open(f,"r") || !(data=file->read()))
// #ifdef THREADS
- catch
+ if (mixed err = catch
{
data = Protocols.HTTP.get_url_nice( f )[1];
- };
+ })
+ werror (describe_backtrace (err));
// #endif
if( !data )
return res;
4822: Inside #if undefined(__NT__)
object privs = Privs("Deleting old pid file.");
r_rm(where);
privs = 0;
- if(catch(Stdio.write_file(where, sprintf("%d\n%d\n", getpid(), getppid()))))
- report_debug("I cannot create the pid file ("+where+").\n");
+ if(mixed err = catch {
+ Stdio.write_file(where, sprintf("%d\n%d\n", getpid(), getppid()));
+ })
+ report_debug("Cannot create the pid file %O: %s",
+ where, describe_error (err));
#endif
}