EINTR problem in async_smb.c

View: New views
3 Messages — Rating Filter:   Alert me  

EINTR problem in async_smb.c

by Jeremy Allison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Volker,

        I think the following patch is needed
in async_smb.c to prevent problems with signal
delivery when called from smbd (or other signal
handling programs).

Can you comment please ?

Jeremy.

diff --git a/source/libsmb/async_smb.c b/source/libsmb/async_smb.c
index 9346264..935ae47 100644
--- a/source/libsmb/async_smb.c
+++ b/source/libsmb/async_smb.c
@@ -360,7 +360,7 @@ static void cli_state_handler(struct event_context *event_ctx,
  }
  cli->evt_inbuf = tmp;
 
- res = recv(cli->fd, cli->evt_inbuf + old_size, available, 0);
+ res = sys_recv(cli->fd, cli->evt_inbuf + old_size, available, 0);
  if (res == -1) {
  DEBUG(10, ("recv failed: %s\n", strerror(errno)));
  status = map_nt_error_from_unix(errno);
@@ -404,7 +404,7 @@ static void cli_state_handler(struct event_context *event_ctx,
  return;
  }
 
- sent = send(cli->fd, req->outbuf + req->sent,
+ sent = sys_send(cli->fd, req->outbuf + req->sent,
     to_send - req->sent, 0);
 
  if (sent < 0) {

Re: EINTR problem in async_smb.c

by Volker Lendecke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 09, 2008 at 03:21:10PM -0700, Jeremy Allison wrote:
> I think the following patch is needed
> in async_smb.c to prevent problems with signal
> delivery when called from smbd (or other signal
> handling programs).
>
> Can you comment please ?

While I hate the fact that you can't just Ctrl-C programs
using sys_recv, probably you're right. Handling EINTR
properly everywhere is a bigger change.

Volker


attachment0 (196 bytes) Download Attachment

Re: EINTR problem in async_smb.c

by Jeremy Allison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 10, 2008 at 12:31:02AM +0200, Volker Lendecke wrote:

> On Thu, Oct 09, 2008 at 03:21:10PM -0700, Jeremy Allison wrote:
> > I think the following patch is needed
> > in async_smb.c to prevent problems with signal
> > delivery when called from smbd (or other signal
> > handling programs).
> >
> > Can you comment please ?
>
> While I hate the fact that you can't just Ctrl-C programs
> using sys_recv, probably you're right. Handling EINTR
> properly everywhere is a bigger change.

Ok, thanks - I'll commit. I was working on a similar
piece of code using your async ideas and needed an
example :-).

Cheers,

Jeremy.
LightInTheBox - Buy quality products at wholesale price!