#include <signal.h>
#endif
-/* XXX If this causes problems, set i_unistd=undef in the hint file. */
-#ifdef I_UNISTD
-# include <unistd.h>
-#endif
-
#ifdef SOCKS_64BIT_BUG
typedef struct __s64_iobuffer {
struct __s64_iobuffer *next, *last; /* Queue pointer */
int *buffer; /* the buffer */
} S64_IOB;
-static S64_IOB *_s64_get_buffer( PerlIO *f);
-static S64_IOB *_s64_create_buffer( PerlIO *f);
-static int _s64_malloc( S64_IOB *ptr);
#endif
bool
IoTYPE(io) = IoTYPE_RDONLY;
/*SUPPRESS 530*/
for (; isSPACE(*name); name++) ;
+ mode[0] = 'r';
+ if (in_raw)
+ strcat(mode, "b");
+ else if (in_crlf)
+ strcat(mode, "t");
if (strEQ(name,"-")) {
fp = PerlIO_stdin();
IoTYPE(io) = IoTYPE_STD;
}
else {
- mode[0] = 'r';
- if (in_raw)
- strcat(mode, "b");
- else if (in_crlf)
- strcat(mode, "t");
fp = PerlIO_open(name,mode);
}
}
Perl_warner(aTHX_ WARN_NEWLINE, PL_warn_nl, "open");
goto say_false;
}
- if (IoTYPE(io) &&
- IoTYPE(io) != IoTYPE_PIPE && IoTYPE(io) != IoTYPE_STD) {
+ if (IoTYPE(io) && IoTYPE(io) != IoTYPE_PIPE && IoTYPE(io) != IoTYPE_STD) {
dTHR;
if (PerlLIO_fstat(PerlIO_fileno(fp),&PL_statbuf) < 0) {
(void)PerlIO_close(fp);
#endif /* SYSV IPC */
+#ifdef SOCKS_64BIT_BUG
+
/**
** getc and ungetc wrappers for the 64 bit problems with SOCKS 5 support
** Workaround to the problem, that SOCKS maps a socket 'getc' to revc
** without checking the ungetc buffer.
**/
-#ifdef SOCKS_64BIT_BUG
+
static S64_IOB *s64_buffer = (S64_IOB *) NULL;
+/* initialize the buffer area */
+/* required after a fork(2) call in order to remove side effects */
+void Perl_do_s64_init_buffer() {
+ s64_buffer = (S64_IOB *) NULL;
+}
+
/* get a buffered stream pointer */
-static S64_IOB *_s64_get_buffer( PerlIO *f) {
+static S64_IOB *S_s64_get_buffer( PerlIO *fp) {
S64_IOB *ptr = s64_buffer;
- while( ptr && ptr->fp != f)
+ while( ptr && ptr->fp != fp)
ptr = ptr->next;
return( ptr);
}
/* create a buffered stream pointer */
-static S64_IOB *_s64_create_buffer( PerlIO *f) {
+static S64_IOB *S_s64_create_buffer( PerlIO *f) {
S64_IOB *ptr = malloc( sizeof( S64_IOB));
if( ptr) {
ptr->fp = f;
/* internal buffer management */
#define _S64_BUFFER_SIZE 32
-static int _s64_malloc( S64_IOB *ptr) {
+static int S_s64_malloc( S64_IOB *ptr) {
if( ptr) {
if( !ptr->buffer) {
ptr->buffer = (int *) calloc( _S64_BUFFER_SIZE, sizeof( int));