[usocket-cvs] r279 - usocket/branches/0.3.x/backend

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Wed Jul 25 20:56:39 UTC 2007


Author: ehuelsmann
Date: Wed Jul 25 16:56:39 2007
New Revision: 279

Modified:
   usocket/branches/0.3.x/backend/sbcl.lisp
Log:
Backport r278 from trunk (fix use of stack allocated value in ECL).

Modified: usocket/branches/0.3.x/backend/sbcl.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/sbcl.lisp	(original)
+++ usocket/branches/0.3.x/backend/sbcl.lisp	Wed Jul 25 16:56:39 2007
@@ -42,19 +42,21 @@
    "#include <sys/socket.h>"
    #+:wsock
    "#include <winsock2.h>"
+
+   "#include <string.h>"
    )
 
   (defun get-host-name ()
     (ffi:c-inline
-     () () t
+     () () :object
      "{ char buf[256];
-        int r = gethostname(&buf,256);
+        int  = gethostname(&buf,256);
 
         if (r == 0)
-           @(return) = make_simple_base_string(&buf);
+           @(return) = make_simple_base_string(strndup(&buf,255));
         else
            @(return) = Cnil;
-      }")))
+      }" :one-liner nil :side-effects nil)))
 
 (defun map-socket-error (sock-err)
   (map-errno-error (sb-bsd-sockets::socket-error-errno sock-err)))



More information about the usocket-cvs mailing list