Module: wine Branch: master Commit: 44043a7dd0b718bbe25c6f6cb6a61625f1fb9f7f URL: http://source.winehq.org/git/wine.git/?a=commit;h=44043a7dd0b718bbe25c6f6cb6...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jul 10 20:15:15 2008 +0200
server: Better handling of errors when accessing the /proc control files on Solaris.
---
server/procfs.c | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/server/procfs.c b/server/procfs.c index b15bfcd..da22af3 100644 --- a/server/procfs.c +++ b/server/procfs.c @@ -46,8 +46,22 @@ static int open_proc_as( struct process *process, int flags ) char buffer[32]; int fd;
+ if (process->unix_pid == -1) + { + set_error( STATUS_ACCESS_DENIED ); + return -1; + } + sprintf( buffer, "/proc/%u/as", process->unix_pid ); - if ((fd = open( buffer, flags )) == -1) file_set_error(); + if ((fd = open( buffer, flags )) == -1) + { + if (errno == ENOENT) /* probably got killed */ + { + process->unix_pid = -1; + set_error( STATUS_ACCESS_DENIED ); + } + else file_set_error(); + } return fd; }
@@ -56,8 +70,16 @@ static int open_proc_lwpctl( struct thread *thread ) char buffer[48]; int fd;
+ if (thread->unix_pid == -1) return -1; + sprintf( buffer, "/proc/%u/lwp/%u/lwpctl", thread->unix_pid, thread->unix_tid ); - if ((fd = open( buffer, O_WRONLY )) == -1) file_set_error(); + if ((fd = open( buffer, O_WRONLY )) == -1) + { + if (errno == ENOENT) /* probably got killed */ + thread->unix_pid = thread->unix_tid = -1; + else + file_set_error(); + } return fd; }