From 8e14dbb1ec95fa7fde6ab8fa65d49d0c1661f8fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wilhelm=20K=C3=B6hler?= <wk@cs.tu-berlin.de>
Date: Thu, 1 Apr 1999 17:20:27 +0200
Subject: [PATCH] =?UTF-8?q?Fixed=20bug=20in=20file=5Fset=5Fkeepalive().=20?=
 =?UTF-8?q?Thanks=20to=20Wilhelm=20K=C3=B6hler=20<wk@cs.tu-berlin.de>.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Rev: src/modules/files/file.c:1.143
---
 src/modules/files/file.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index d6d8536d1c..4894568db1 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: file.c,v 1.142 1999/03/31 23:29:12 grubba Exp $");
+RCSID("$Id: file.c,v 1.143 1999/04/01 15:20:27 grubba Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -2030,10 +2030,15 @@ static void file_open_socket(INT32 args)
 static void file_set_keepalive(INT32 args)
 {
   int tmp, i;
-  check_all_args("file->set_keepalive",args, T_INT,0);
-  tmp=sp[-args].u.integer;
+  INT_TYPE t;
+
+  get_all_args("file->set_keepalive", args, "%i", &t);
+
+  /* In case int and INT_TYPE have different sizes */
+  tmp = t;
+
 #ifdef SO_KEEPALIVE
-  i=fd_setsockopt(FD,SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
+  i = fd_setsockopt(FD,SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
   if(i)
   {
     ERRNO=errno;
@@ -2042,7 +2047,7 @@ static void file_set_keepalive(INT32 args)
   }
 #else /* !SO_KEEPALIVE */
 #ifdef ENOTSUP
-  ERRNO=ENOTSUP;
+  ERRNO = ENOTSUP;
 #else /* !ENOTSUP */
 #ifdef ENOTTY
   ERRNO = ENOTTY;
-- 
GitLab