Module: wine Branch: refs/heads/master Commit: 5558652ea3607f282c280000e3fef47f6be4319d URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=5558652ea3607f282c280000...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jun 8 10:26:02 2006 +0200
server: Don't report a fatal protocol error for things that we can recover from.
---
server/event.c | 3 ++- server/process.c | 4 ++-- server/request.c | 6 +++++- server/thread.c | 26 +++++++++++--------------- server/trace.c | 1 + 5 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/server/event.c b/server/event.c index 71c8a81..47dde24 100644 --- a/server/event.c +++ b/server/event.c @@ -215,7 +215,8 @@ DECL_HANDLER(event_op) reset_event( event ); break; default: - fatal_protocol_error( current, "event_op: invalid operation %d\n", req->op ); + set_error( STATUS_INVALID_PARAMETER ); + break; } release_object( event ); } diff --git a/server/process.c b/server/process.c index 3d53115..0c71540 100644 --- a/server/process.c +++ b/server/process.c @@ -335,7 +335,7 @@ size_t init_process( struct thread *thre if (!process->handles) process->handles = alloc_handle_table( process, 0 ); if (!process->handles) { - fatal_protocol_error( thread, "Failed to allocate handle table\n" ); + set_error( STATUS_NO_MEMORY ); return 0; }
@@ -895,7 +895,7 @@ DECL_HANDLER(init_process_done)
if (is_process_init_done(process)) { - fatal_protocol_error( current, "init_process_done: called twice\n" ); + set_error( STATUS_INVALID_PARAMETER ); return; } if (!(dll = find_process_dll( process, req->module ))) diff --git a/server/request.c b/server/request.c index 9ae5fa4..a78916e 100644 --- a/server/request.c +++ b/server/request.c @@ -293,7 +293,11 @@ static void call_req_handler( struct thr if (debug_level) trace_reply( req, &reply ); send_reply( &reply ); } - else fatal_protocol_error( current, "no reply fd for request %d\n", req ); + else + { + current->exit_code = 1; + kill_thread( current, 1 ); /* no way to continue without reply fd */ + } } current = NULL; } diff --git a/server/thread.c b/server/thread.c index bc8b4f4..40b9615 100644 --- a/server/thread.c +++ b/server/thread.c @@ -842,26 +842,22 @@ DECL_HANDLER(init_thread) int reply_fd = thread_get_inflight_fd( current, req->reply_fd ); int wait_fd = thread_get_inflight_fd( current, req->wait_fd );
- if (current->unix_pid != -1) + if (current->reply_fd) /* already initialised */ { - fatal_protocol_error( current, "init_thread: already running\n" ); - goto error; - } - if (reply_fd == -1 || fcntl( reply_fd, F_SETFL, O_NONBLOCK ) == -1) - { - fatal_protocol_error( current, "bad reply fd\n" ); + set_error( STATUS_INVALID_PARAMETER ); goto error; } + + if (reply_fd == -1 || fcntl( reply_fd, F_SETFL, O_NONBLOCK ) == -1) goto error; + + current->reply_fd = create_anonymous_fd( &thread_fd_ops, reply_fd, ¤t->obj ); + reply_fd = -1; + if (!current->reply_fd) goto error; + if (wait_fd == -1) { - fatal_protocol_error( current, "bad wait fd\n" ); - goto error; - } - if (!(current->reply_fd = create_anonymous_fd( &thread_fd_ops, reply_fd, ¤t->obj ))) - { - reply_fd = -1; - fatal_protocol_error( current, "could not allocate reply fd\n" ); - goto error; + set_error( STATUS_TOO_MANY_OPENED_FILES ); /* most likely reason */ + return; } if (!(current->wait_fd = create_anonymous_fd( &thread_fd_ops, wait_fd, ¤t->obj ))) return; diff --git a/server/trace.c b/server/trace.c index 5d2c525..9b5cc39 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3980,6 +3980,7 @@ static const struct { "SHARING_VIOLATION", STATUS_SHARING_VIOLATION }, { "SUSPEND_COUNT_EXCEEDED", STATUS_SUSPEND_COUNT_EXCEEDED }, { "TIMEOUT", STATUS_TIMEOUT }, + { "TOO_MANY_OPENED_FILES", STATUS_TOO_MANY_OPENED_FILES }, { "UNSUCCESSFUL", STATUS_UNSUCCESSFUL }, { "VOLUME_DISMOUNTED", STATUS_VOLUME_DISMOUNTED }, { "WAS_LOCKED", STATUS_WAS_LOCKED },