Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-03

Socket() call broken in 1.9.3 CVS?

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lloyd B. Park

I pulled in 1.9.3 from CVS yesterday. When I recompiled some code I have been working on I found my program crashed when creating a socket. The program fails with no error. It just exits. I created a test program with just the socket call and it also fails the same way. Here is the code:

   Program test_socket;
   uses
      sockets;
   var
      FileHandle:  integer;
   begin
      writeln( 'sizeof( integer): ', sizeof( integer));
      writeln( 'Before socket call.');
      FileHandle:= socket( AF_INET, SOCK_DGRAM, 0);
      writeln( 'After socket call.');
   end.

I followed the CVS download instructions on the Web site. Do I need to look at a different branch?

cvs -d login
cvs -z 3 -d checkout fpc

------------------------------------ Lloyd B. Park (330) 672-0384 Administrative Services Building Kent State University Kent, OH 44242 ------------------------------------
Unknown author
to Lloyd B. Park
Lloyd B. Park wrote 12 lines
I pulled in 1.9.3 from CVS yesterday. When I recompiled some code I have been working on I found my program crashed when creating a socket. The program fails with no error. It just exits. I created a test program with just the socket call and it also fails the same way. Here is the code: Program test_socket; uses sockets; var FileHandle: integer;

Careful, this should be compiled using -S2 or {$Mode Objfpc} !

It works fine here:
ome: >tests
sizeof( integer): 4
Before socket call.
After socket call.
home: >ppc386 -S2 -l tests.pp
Free Pascal Compiler version 1.9.3 [2004/02/15] for i386 Copyright (c) 1993-2004 by Florian Klaempfl

Michael.

Marco van de Voort
to Lloyd B. Park: I pulled in 1.9.3 from CVS yesterday. When I recompiled some code I have been working on…
Show quoted text 5 lines
I pulled in 1.9.3 from CVS yesterday. When I recompiled some code I have been working on I found my program crashed when creating a socket. The program fails with no error. It just exits. I created a test program with just the socket call and it also fails the same way. Here is the code:

Search and replace error probably. Update, and make sure you get

Checking in unixsock.inc;
/FPC/CVS/fpc/rtl/linux/unixsock.inc,v <-- unixsock.inc new revision: 1.11; previous revision: 1.10

Show quoted text 15 lines
Program test_socket; uses sockets; var FileHandle: integer; begin writeln( 'sizeof( integer): ', sizeof( integer)); writeln( 'Before socket call.'); FileHandle:= socket( AF_INET, SOCK_DGRAM, 0); writeln( 'After socket call.'); end. I followed the CVS download instructions on the Web site. Do I need to look at a different branch?

No. Just a small typo, sockets was changed last weekend, thanks for the report.

P.s. Michael is right btw, and it is wiser to use a 32-bit type that doesn't depend on mode for handles like this ( cint is logical)