Various patches to fix errors when using the newest glibc,

replaced use of insecure tempnam() function
and to remove warnings etc.
This commit is contained in:
paul 2001-03-01 14:59:11 +00:00
parent 8f47d80a0a
commit 10f699ef70
23 changed files with 146 additions and 126 deletions

View File

@ -1,11 +1,16 @@
/*
* $Id: avmcapictrl.c,v 1.15 2000/03/08 13:40:33 calle Exp $
* $Id: avmcapictrl.c,v 1.16 2001/03/01 14:59:11 paul Exp $
*
* AVM-B1-ISDN driver for Linux. (Control-Utility)
*
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log: avmcapictrl.c,v $
* Revision 1.16 2001/03/01 14:59:11 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.15 2000/03/08 13:40:33 calle
* check for /dev/isdn/capi20 if /dev/capi20 doesn't exist.
*
@ -644,8 +649,8 @@ int main(int argc, char **argv)
if (ac >= 5) {
s = argv[arg_ofs + 1];
if (strlen(s) > sizeof(carddef.driver)) {
fprintf(stderr, "%s: driver name > %d\n",
cmd, sizeof(carddef.driver));
fprintf(stderr, "%s: driver name > %lu\n",
cmd, (unsigned long)sizeof(carddef.driver));
exit(1);
}
strncpy(carddef.driver, s, sizeof(carddef.driver));

View File

@ -1,7 +1,12 @@
/*
* $Id: capi20.c,v 1.18 2000/11/12 16:06:41 kai Exp $
* $Id: capi20.c,v 1.19 2001/03/01 14:59:11 paul Exp $
*
* $Log: capi20.c,v $
* Revision 1.19 2001/03/01 14:59:11 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.18 2000/11/12 16:06:41 kai
* fix backwards compatibility in capi20 library, small other changes
*
@ -284,7 +289,7 @@ capi20_put_message (unsigned ApplID, unsigned char *Msg)
if (len >= 30) { /* 64Bit CAPI-extention */
u_int64_t data64;
memcpy(&data64,Msg+22, sizeof(u_int64_t));
if (data64 != 0) dataptr = (void *)data64;
if (data64 != 0) dataptr = (void *)(unsigned long)data64;
else dataptr = Msg + len; /* Assume data after message */
} else {
dataptr = Msg + len; /* Assume data after message */
@ -292,7 +297,7 @@ capi20_put_message (unsigned ApplID, unsigned char *Msg)
} else {
u_int32_t data;
memcpy(&data,Msg+12, sizeof(u_int32_t));
if (data != 0) dataptr = (void *)data;
if (data != 0) dataptr = (void *)(unsigned long)data;
else dataptr = Msg + len; /* Assume data after message */
}
memcpy(sndbuf+len, dataptr, datalen);

View File

@ -1,7 +1,12 @@
/*
* $Id: capidyn.c,v 1.1 2000/05/18 15:21:37 calle Exp $
* $Id: capidyn.c,v 1.2 2001/03/01 14:59:11 paul Exp $
*
* $Log: capidyn.c,v $
* Revision 1.2 2001/03/01 14:59:11 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.1 2000/05/18 15:21:37 calle
* static CAPI2.0 library that loads libcapi20.so dynamicly.
*
@ -9,6 +14,7 @@
#include <sys/types.h>
#include <linux/capi.h>
#include <string.h>
#include "capi20.h"
#include <dlfcn.h>

View File

@ -1,7 +1,12 @@
/*
* $Id: convert.c,v 1.10 2000/05/18 15:02:26 calle Exp $
* $Id: convert.c,v 1.11 2001/03/01 14:59:11 paul Exp $
*
* $Log: convert.c,v $
* Revision 1.11 2001/03/01 14:59:11 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.10 2000/05/18 15:02:26 calle
* Updated _cmsg handling added new functions need by "capiconn".
*
@ -540,7 +545,7 @@ unsigned capi_cmsg2message(_cmsg * cmsg, _cbyte * msg)
cmsg->Data64 = 0;
} else {
cmsg->Data32 = 0;
cmsg->Data64 = (_cqword) cmsg->Data;
cmsg->Data64 = (_cqword)(unsigned long)cmsg->Data;
}
}
@ -621,7 +626,7 @@ unsigned capi_message2cmsg(_cmsg * cmsg, _cbyte * msg)
if (sizeof(void *) == 4) {
cmsg->Data = (void *) cmsg->Data32;
} else {
cmsg->Data = (void *) cmsg->Data64;
cmsg->Data = (void *)(unsigned long)cmsg->Data64;
}
}

View File

@ -1,4 +1,4 @@
/* $Id: data.c,v 1.2 1998/10/23 12:50:52 fritz Exp $
/* $Id: data.c,v 1.3 2001/03/01 14:59:11 paul Exp $
*
* Functions for dealing user data.
* This stuff is based heavily on AVM's CAPI-adk for linux.
@ -15,6 +15,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: data.c,v $
* Revision 1.3 2001/03/01 14:59:11 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.2 1998/10/23 12:50:52 fritz
* Added RCS keywords and GPL notice.
*
@ -41,7 +46,7 @@ unsigned SendData(ConnectionID Connection, void *Data, unsigned short DataLength
assert (GetState(Connection) == Connected);
DATA_B3_REQ_HEADER(&CMSG, Appl_Id, 0, GetConnectionNCCI(Connection));
DATA_B3_REQ_DATA(&CMSG) = (unsigned long)Data;
DATA_B3_REQ_DATA(&CMSG) = Data;
DATA_B3_REQ_DATALENGTH(&CMSG) = DataLength;
DATA_B3_REQ_DATAHANDLE(&CMSG) = DataHandle;
return CAPI_PUT_CMSG(&CMSG);

View File

@ -1,4 +1,4 @@
/* $Id: id.c,v 1.2 1998/10/23 12:50:55 fritz Exp $
/* $Id: id.c,v 1.3 2001/03/01 14:59:11 paul Exp $
*
* Connection-ID management.
* This stuff is based heavily on AVM's CAPI-adk for linux.
@ -15,6 +15,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: id.c,v $
* Revision 1.3 2001/03/01 14:59:11 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.2 1998/10/23 12:50:55 fritz
* Added RCS keywords and GPL notice.
*
@ -52,7 +57,7 @@ typedef struct _ConnectionDesc {
unsigned char *CallingPartyNumberStruct; /* CAPI struct */
} ConnectionDesc;
static ConnectionDesc C[maxConnections] = {0};
static ConnectionDesc C[maxConnections] = {{0}};
static unsigned char *EmptyStruct = (unsigned char *)"\0";
/*

View File

@ -1,4 +1,4 @@
/* $Id: eiconctrl.c,v 1.21 2000/12/02 21:39:42 armin Exp $
/* $Id: eiconctrl.c,v 1.22 2001/03/01 14:59:12 paul Exp $
*
* Eicon-ISDN driver for Linux. (Control-Utility)
*
@ -21,6 +21,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: eiconctrl.c,v $
* Revision 1.22 2001/03/01 14:59:12 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.21 2000/12/02 21:39:42 armin
* Update of load and log utility.
* New firmware and NT mode for PRI card.
@ -284,12 +289,12 @@ t_dsp_combifile_directory_entry *display_combifile_details(char *details)
download_count = file_header->download_count;
directory_size = file_header->directory_size;
return_ptr = (t_dsp_combifile_directory_entry *) (unsigned int)file_header ;
return_ptr = (t_dsp_combifile_directory_entry *) (unsigned long)file_header ;
offset += (file_header->header_size);
offset += (file_header->combifile_description_size);
offset += (__u32)return_ptr;
offset += (__u32)(unsigned long)return_ptr;
return (t_dsp_combifile_directory_entry *)offset;
return (t_dsp_combifile_directory_entry *)(unsigned long)offset;
}
@ -439,7 +444,7 @@ __u32 get_download(char *download_block, char *download_area)
#endif
addr = store_download(data, p_download_desc->excess_header_size,
download_block);
p_download_desc->p_excess_header_data = (char *)addr;
p_download_desc->p_excess_header_data = (char *)(unsigned long)addr;
data += ((p_download_desc->excess_header_size));
}
p_download_desc->p_download_description = NULL;
@ -457,7 +462,7 @@ __u32 get_download(char *download_block, char *download_area)
printf("\t%s\n", Text);
}
p_download_desc->p_download_description = (char *)addr;
p_download_desc->p_download_description = (char *)(unsigned long)addr;
data += ((file_header->download_description_size));
}
p_download_desc->p_memory_block_table = NULL;
@ -468,7 +473,7 @@ __u32 get_download(char *download_block, char *download_area)
#endif
addr = store_download(data, file_header->memory_block_table_size,
download_block);
p_download_desc->p_memory_block_table = (t_dsp_memory_block_desc *)addr;
p_download_desc->p_memory_block_table = (t_dsp_memory_block_desc *)(unsigned long)addr;
data += ((file_header->memory_block_table_size));
}
p_download_desc->p_segment_table = NULL;
@ -479,7 +484,7 @@ __u32 get_download(char *download_block, char *download_area)
#endif
addr = store_download(data, file_header->segment_table_size,
download_block);
p_download_desc->p_segment_table = (t_dsp_segment_desc *)addr;
p_download_desc->p_segment_table = (t_dsp_segment_desc *)(unsigned long)addr;
data += (file_header->segment_table_size);
}
p_download_desc->p_symbol_table = NULL;
@ -490,7 +495,7 @@ __u32 get_download(char *download_block, char *download_area)
#endif
addr = store_download(data, file_header->symbol_table_size,
download_block);
p_download_desc->p_symbol_table = (t_dsp_symbol_desc *)addr;
p_download_desc->p_symbol_table = (t_dsp_symbol_desc *)(unsigned long)addr;
data += (file_header->symbol_table_size);
}
p_download_desc->p_data_blocks_dm = NULL;
@ -501,7 +506,7 @@ __u32 get_download(char *download_block, char *download_area)
#endif
addr = store_download(data, file_header->total_data_size_dm,
download_block);
p_download_desc->p_data_blocks_dm = (__u16 *)addr;
p_download_desc->p_data_blocks_dm = (__u16 *)(unsigned long)addr;
data += (file_header->total_data_size_dm);
}
p_download_desc->p_data_blocks_pm = NULL;
@ -512,7 +517,7 @@ __u32 get_download(char *download_block, char *download_area)
#endif
addr = store_download(data, file_header->total_data_size_pm,
download_block);
p_download_desc->p_data_blocks_pm = (__u16 *)addr;
p_download_desc->p_data_blocks_pm = (__u16 *)(unsigned long)addr;
data += (file_header->total_data_size_pm);
}
}

View File

@ -1,4 +1,4 @@
/* $Id: access.c,v 1.3 1999/10/06 18:16:22 he Exp $ */
/* $Id: access.c,v 1.4 2001/03/01 14:59:12 paul Exp $ */
/* Copyright 1997 by Henner Eisen
This code is free software; you can redistribute it and/or
@ -16,6 +16,7 @@
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include <tdu_user.h>
#include "tdu.h"

View File

@ -1,4 +1,4 @@
/* $Id: eft_client.c,v 1.2 1999/10/06 18:16:22 he Exp $ */
/* $Id: eft_client.c,v 1.3 2001/03/01 14:59:12 paul Exp $ */
/*
Copyright 1998 by Henner Eisen
@ -17,12 +17,13 @@
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <tdu_user.h>

View File

@ -1,4 +1,4 @@
/* $Id: eft_tmpfile.c,v 1.1 1999/06/30 17:18:24 he Exp $ */
/* $Id: eft_tmpfile.c,v 1.2 2001/03/01 14:59:12 paul Exp $ */
/*
Copyright 1998 by Henner Eisen
@ -17,31 +17,25 @@
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <eft.h>
#include "eft_private.h"
#include <malloc.h>
int eft_make_tmp()
int eft_make_tmp(void)
{
char * tmp;
char tmp[sizeof("/tmp/eftXXXXXX\0")];
int fd;
struct stat stat_ln, stat_fd;
tmp = tempnam("/tmp", "eft");
if( ! tmp ){
perror("eft_make_tmp:tmpnam");
return -1;
}
if( (fd = open(tmp,O_RDWR|O_CREAT),0600) < 0 ){
perror("eft_make_tmp:open");
free(tmp);
strcpy(tmp, "/tmp/eftXXXXXX");
if( (fd = mkstemp(tmp)) < 0 ){
perror("eft_make_tmp:mkstemp");
return -1;
}
@ -55,13 +49,11 @@ int eft_make_tmp()
if( lstat(tmp, &stat_ln) || fstat(fd,&stat_fd)
|| memcmp(&stat_ln, &stat_fd, sizeof(stat_ln) )){
fprintf(stderr,"eft_make_tmp(): symlink attack for \"%s\" defended\n",tmp);
free(tmp);
close(fd);
return -1;
}
if( unlink(tmp) ) perror("unlink()");
free(tmp);
return fd;
}

View File

@ -1,4 +1,4 @@
/* $Id: fileheader.c,v 1.3 2000/01/26 20:11:34 he Exp $ */
/* $Id: fileheader.c,v 1.4 2001/03/01 14:59:12 paul Exp $ */
/*
Copyright 1998 by Henner Eisen
@ -25,11 +25,12 @@
This file containing stuff used for processing of file headers.
*/
#include <stdio.h>
#include <sys/stat.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <pwd.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
/* $Id: tdu.c,v 1.1 1999/06/30 17:18:40 he Exp $ */
/* $Id: tdu.c,v 1.2 2001/03/01 14:59:12 paul Exp $ */
/*
Copyright 1997 by Henner Eisen
@ -46,6 +46,7 @@
#include <unistd.h>
#include <string.h>
#include <time.h>
#include "tdu_user.h"
#include "tdu.h"
#include "sbv.h"

View File

@ -1,4 +1,4 @@
/* $Id: tdu_log.c,v 1.1 1999/06/30 17:18:44 he Exp $ */
/* $Id: tdu_log.c,v 1.2 2001/03/01 14:59:12 paul Exp $ */
/*
Copyright 1997 by Henner Eisen
@ -18,6 +18,7 @@
*/
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>

View File

@ -1,4 +1,4 @@
/* $Id: eftd.c,v 1.5 1999/10/08 16:25:36 he Exp $ */
/* $Id: eftd.c,v 1.6 2001/03/01 14:59:13 paul Exp $ */
/*
Copyright 1998 by Henner Eisen
@ -25,8 +25,9 @@
/* for strsignal() */
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <time.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
@ -51,7 +52,6 @@
#endif
#include <pwd.h>
#include <sys/types.h>
#ifdef __USE_GNU
/* Return a string describing the meaning of the signal number in SIG. */

View File

@ -32,6 +32,7 @@
#include <stdio.h>
#include <errno.h>
#include <malloc.h>
#include <string.h>
#ifdef SYSSYSLOG
#include <sys/syslog.h>

View File

@ -25,7 +25,7 @@
* PATCHLEVEL 9
*/
char main_rcsid[] = "$Id: main.c,v 1.18 2000/07/25 20:23:51 kai Exp $";
char main_rcsid[] = "$Id: main.c,v 1.19 2001/03/01 14:59:14 paul Exp $";
#include <stdio.h>
#include <stdarg.h>
@ -43,7 +43,7 @@ char main_rcsid[] = "$Id: main.c,v 1.18 2000/07/25 20:23:51 kai Exp $";
#include <sys/param.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <time.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/socket.h>

View File

@ -1,4 +1,4 @@
/* $Id: isdn_dwabclib.c,v 1.1 1999/11/07 22:04:05 detabc Exp $
/* $Id: isdn_dwabclib.c,v 1.2 2001/03/01 14:59:15 paul Exp $
*
*
* This program is free software; you can redistribute it and/or modify
@ -16,18 +16,24 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdn_dwabclib.c,v $
* Revision 1.2 2001/03/01 14:59:15 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.1 1999/11/07 22:04:05 detabc
* add dwabc-udpinfo-utilitys in isdnctrl
*
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include <netinet/in.h>
@ -91,7 +97,7 @@ err:;
ms->sin_port = htons(20000+po);
if(!bind(sock,ms,sizeof(*ms)))
if(!bind(sock, (struct sockaddr *)ms, sizeof(*ms)))
break;
}
@ -106,7 +112,7 @@ err:;
ms->sin_port = htons(25001);
memcpy(&ms->sin_addr.s_addr,*(he->h_addr_list),he->h_length);
if(sendto(sock,buf,bytes,0,ms,sizeof(*ms)) != bytes) {
if(sendto(sock,buf,bytes,0,(struct sockaddr *)ms,sizeof(*ms)) != bytes) {
sprintf(em,"sendto <%s> failt errno %d",dest,errno);
goto err;

View File

@ -1,4 +1,4 @@
/* $Id: isdnctrl.c,v 1.44 2000/08/17 09:24:06 paul Exp $
/* $Id: isdnctrl.c,v 1.45 2001/03/01 14:59:15 paul Exp $
* ISDN driver for Linux. (Control-Utility)
*
* Copyright 1994,95 by Fritz Elfert (fritz@isdn4linux.de)
@ -21,6 +21,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnctrl.c,v $
* Revision 1.45 2001/03/01 14:59:15 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.44 2000/08/17 09:24:06 paul
* Added --version option to display (isdn4k-utils) version,
* and fixed a compile warning on alpha.
@ -496,7 +501,7 @@ static void listbind(char *s, int e)
int ch;
sscanf(p + 1, "%d", &ch);
*p = '\0';
printf("%s, Channel %d%s\n", s, ch, (e > 0) ? ", exclusive" : "");
printf("%s, channel %d%s\n", s, ch, (e > 0) ? ", exclusive" : "");
} else
printf("Nothing\n");
}

View File

@ -1,4 +1,4 @@
/* $Id: isdnrate.c,v 1.37 2000/07/17 16:34:23 akool Exp $
/* $Id: isdnrate.c,v 1.38 2001/03/01 14:59:16 paul Exp $
* ISDN accounting for isdn4linux. (rate evaluation)
*
@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrate.c,v $
* Revision 1.38 2001/03/01 14:59:16 paul
* Various patches to fix errors when using the newest glibc,
* replaced use of insecure tempnam() function
* and to remove warnings etc.
*
* Revision 1.37 2000/07/17 16:34:23 akool
* isdnlog-4.32
* - added new Prefixes 0160 (D1) and 0162 (D2) to "country-de.dat"
@ -1573,7 +1578,7 @@ static void setup_daemon()
struct sockaddr_in client;
fd_set active_fd_set, read_fd_set;
char *sock_name = socket_file;
size_t size;
socklen_t size;
struct stat stat_buf;
int i;
pid_t pid;

View File

@ -1,5 +1,5 @@
/*
** $Id: libvbox.c,v 1.11 1997/10/22 20:47:06 fritz Exp $
** $Id: libvbox.c,v 1.12 2001/03/01 14:59:16 paul Exp $
**
** Copyright (C) 1996, 1997 Michael 'Ghandi' Herold
*/
@ -19,6 +19,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>

View File

@ -1,5 +1,5 @@
/*
** $Id: vbox.c,v 1.9 1998/12/31 09:57:27 paul Exp $
** $Id: vbox.c,v 1.10 2001/03/01 14:59:16 paul Exp $
**
** Copyright (C) 1996, 1997 Michael 'Ghandi' Herold
*/
@ -1547,7 +1547,7 @@ static void draw_message_list(void)
static void play_message(int msg)
{
struct messageline *msgline;
char *msgname;
char msgname[sizeof("/tmp/vboxXXXXXX\0")];
char *command;
char *answer;
int size;
@ -1557,19 +1557,15 @@ static void play_message(int msg)
if ((!messagesmp) || (messagesnr < 1)) return;
msgline = (struct messageline *)(messagesmp + (sizeof(struct messageline) * msg));
msgname = tmpnam(NULL);
if ((!msgline) || (!msgname))
if (!msgline)
{
message("\r\n", "Can't create temporary file! %s", "[RETURN]");
message("\r\n", "No message found! (can't happen?) %s", "[RETURN]");
return;
}
if ((fd = open(msgname, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR)) == -1)
strcpy(msgname, "/tmp/vboxXXXXXX");
if ((fd = mkstemp(msgname)) == -1)
{
message("\r\n", "Can't open temporary file! %s", "[RETURN]");
return;
}

View File

@ -1,5 +1,5 @@
/*
** $Id: vboxconvert.c,v 1.9 2000/09/15 09:08:37 paul Exp $
** $Id: vboxconvert.c,v 1.10 2001/03/01 14:59:16 paul Exp $
**
** Copyright (C) 1996, 1997 Michael 'Ghandi' Herold
**
@ -116,7 +116,7 @@ static struct option args_autovbox[] =
static char *vbasename = NULL;
static FILE *vboxtmpfile = NULL;
static char *vboxtmpname = NULL;
static char perrormsg[256];
/** Prototypes ***********************************************************/
@ -347,7 +347,6 @@ static void start_vboxtoau(int samplemode, int samplerate)
int compression;
int result;
vboxtmpname = NULL;
vboxtmpfile = NULL;
signal(SIGINT , leave_vboxtoau);
@ -356,24 +355,17 @@ static void start_vboxtoau(int samplemode, int samplerate)
signal(SIGHUP , leave_vboxtoau);
signal(SIGPIPE, leave_vboxtoau);
if (!(vboxtmpname = tempnam("/tmp", "vbox")))
if (!(vboxtmpfile = tmpfile()))
{
fprintf(stderr, "%s: can't create a temporary file.\n", vbasename);
leave_vboxtoau(255);
}
if (!(vboxtmpfile = fopen(vboxtmpname, "w+")))
{
fprintf(stderr, "%s: can't create \"%s\".\n", vbasename, vboxtmpname);
sprintf(perrormsg, "%s: can't create tmpfile", vbasename);
perror(perrormsg);
leave_vboxtoau(255);
}
if (fread(&header, sizeof(vaheader_t), 1, stdin) != 1)
{
fprintf(stderr, "%s: can't read vbox audio header.\n", vbasename);
sprintf(perrormsg, "%s: can't read vbox audio header", vbasename);
perror(perrormsg);
leave_vboxtoau(255);
}
@ -419,14 +411,8 @@ static void start_vboxtoau(int samplemode, int samplerate)
static void leave_vboxtoau(int sig)
{
if (vboxtmpfile) fclose(vboxtmpfile);
if (vboxtmpname)
{
unlink(vboxtmpname);
free(vboxtmpname);
}
if (vboxtmpfile)
fclose(vboxtmpfile);
exit(sig);
}
@ -507,7 +493,6 @@ static void start_autovbox(int compression, char *name, char *id, char *phone, c
vaheader_t header;
int result;
vboxtmpname = NULL;
vboxtmpfile = NULL;
signal(SIGINT , leave_autovbox);
@ -516,17 +501,10 @@ static void start_autovbox(int compression, char *name, char *id, char *phone, c
signal(SIGHUP , leave_autovbox);
signal(SIGPIPE, leave_autovbox);
if (!(vboxtmpname = tempnam("/tmp", "vbox")))
if (!(vboxtmpfile = tmpfile()))
{
fprintf(stderr, "%s: can't create a temporary file.\n", vbasename);
leave_autovbox(255);
}
if (!(vboxtmpfile = fopen(vboxtmpname, "w+")))
{
fprintf(stderr, "%s: can't create \"%s\".\n", vbasename, vboxtmpname);
sprintf(perrormsg, "%s: can't create tmpfile", vbasename);
perror(perrormsg);
leave_autovbox(255);
}
@ -580,14 +558,8 @@ static void start_autovbox(int compression, char *name, char *id, char *phone, c
static void leave_autovbox(int sig)
{
if (vboxtmpfile) fclose(vboxtmpfile);
if (vboxtmpname)
{
unlink(vboxtmpname);
free(vboxtmpname);
}
if (vboxtmpfile)
fclose(vboxtmpfile);
exit(sig);
}
@ -832,13 +804,13 @@ static int convert_pvf_to_au(int mode, int rate, FILE *in, FILE *out)
Snd.channelCount = 1;
Snd.info[0] = 0;
write_one_word((int)Snd.magic , out);
write_one_word((int)Snd.magic, out);
write_one_word((int)Snd.dataLocation, out);
write_one_word((int)Snd.dataSize , out);
write_one_word((int)Snd.dataFormat , out);
write_one_word((int)Snd.dataSize, out);
write_one_word((int)Snd.dataFormat, out);
write_one_word((int)Snd.samplingRate, out);
write_one_word((int)Snd.channelCount, out);
write_one_word((int)Snd.info , out);
write_one_word(*((int *)Snd.info), out);
while (1)
{

View File

@ -34,13 +34,14 @@ from the X Consortium.
*
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <linux/isdn.h>
#include <X11/Intrinsic.h>