handle errors from receive_smb better, and print error string
authorAndrew Tridgell <tridge@samba.org>
Wed, 29 May 1996 07:54:01 +0000 (07:54 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 29 May 1996 07:54:01 +0000 (07:54 +0000)
(This used to be commit 7814eca4b22f909e75c3321d9a157c2228198c5c)

source3/lib/util.c
source3/smbd/server.c

index 233e9872711cdb0a683cd04a4cf0ecde24822cf6..e983a74673115c0b11eede961a60c8d7f47e789b 100644 (file)
@@ -2683,12 +2683,11 @@ BOOL receive_smb(int fd,char *buffer,int timeout)
   if (len == -1)
     return(False);
 
   if (len == -1)
     return(False);
 
-  if (len > BUFFER_SIZE)
-    {
-      DEBUG(0,("Invalid packet length! (%d bytes)\n",len));
-      if (len > BUFFER_SIZE + (SAFETY_MARGIN/2))
-       exit(1);
-    }
+  if (len > BUFFER_SIZE) {
+    DEBUG(0,("Invalid packet length! (%d bytes)\n",len));
+    if (len > BUFFER_SIZE + (SAFETY_MARGIN/2))
+      exit(1);
+  }
 
   ok = (read_data(fd,buffer+4,len) == len);
 
 
   ok = (read_data(fd,buffer+4,len) == len);
 
index 1d024770739de61acefea44cd750cbd62bba7207..00f8c9e0fd67ff434cfd555b916539eee343cab5 100644 (file)
@@ -2394,7 +2394,8 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
 
   if (ChDir(pcon->connectpath) != 0)
     {
 
   if (ChDir(pcon->connectpath) != 0)
     {
-      DEBUG(0,("Can't change directory to %s\n",pcon->connectpath));
+      DEBUG(0,("Can't change directory to %s (%s)\n",
+              pcon->connectpath,strerror(errno)));
       pcon->open = False;
       unbecome_user();
       if (!IS_IPC(cnum)) {
       pcon->open = False;
       unbecome_user();
       if (!IS_IPC(cnum)) {
@@ -3721,8 +3722,8 @@ void process(void )
          extern int keepalive;
 
          /* check for socket failure */
          extern int keepalive;
 
          /* check for socket failure */
-         if (errno == EBADF) {
-           DEBUG(3,("%s Bad file descriptor - exiting\n",timestring()));
+         if (errno) {
+           DEBUG(3,("receive_smb error (%s) exiting\n",strerror(errno)));
            return;
          }
 
            return;
          }