diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index cfa465da8..684f087b0 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -915,6 +915,37 @@ of its CALLBACK objects.

+

Routine epicsTempName() removed from libCom

+ +

This routine was a simple wrapper around the C89 function tmpnam() +which is now seen as unsafe and causes warning messages to be generated by +most modern compilers. The two internal uses of this function have been +modified to call epicsTempFile() instead. We were unable to find any +published code that used this function, so it was removed immediately instead +of being deprecated.

+ +

DBD Parsing of Record Types

+ +

The Perl DBD file parser has been made slightly more liberal; the order in +which DBD files must be parsed is now more flexible, so that a record type +definition can now be parsed after a device support that referred to that +record type. A warning message will be displayed when the device support is +seen, but the subsequent loading of the record type will be accepted without +triggering an error. See +Launchpad bug +#1801145.

+ +

menuScan and several record types documented with POD

+ +

The EPICS Wiki pages describing a number of standard record types has been +converted into the Perl POD documentation format and added to the DBD files, +so at build-time an HTML version of these documents is generated and installed +into the htmls directory. Thanks to Tony Pietryla.

+ +

CA client tools learned -V option

+ +

This displays the version numbers of EPICS Base and the CA protocol.

+

Changes made between 3.15.5 and 3.15.6

diff --git a/modules/libcom/src/flex/flex.c b/modules/libcom/src/flex/flex.c index 8d0400c2b..008e5e670 100644 --- a/modules/libcom/src/flex/flex.c +++ b/modules/libcom/src/flex/flex.c @@ -98,7 +98,6 @@ int num_backtracking, bol_needed; FILE *temp_action_file; FILE *backtrack_file; int end_of_buffer_state; -char action_file_name[256>L_tmpnam?256:L_tmpnam]; char **input_files; int num_input_files; char *program_name; @@ -210,10 +209,7 @@ void flexend(int status) else if ( fclose( temp_action_file ) ) flexfatal( "error occurred when closing temporary action file" ); - - else if ( unlink( action_file_name ) ) - flexfatal( "error occurred when deleting temporary action file" ); - } + } if ( status != 0 && outfile_created ) { @@ -598,15 +594,11 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */ if ( (skelfile = fopen( skelname, "r" )) == NULL ) lerrsf( "can't open skeleton file %s", skelname ); - epicsTempName ( action_file_name, sizeof ( action_file_name ) ); - if ( action_file_name[0] == '\0' ) + if ( ( temp_action_file = epicsTempFile () ) == NULL ) { - lerrsf( "can't create temporary file name", "" ); + lerrsf( "can't create temporary action file", "" ); } - if ( ( temp_action_file = fopen ( action_file_name, "w" ) ) == NULL ) - lerrsf( "can't open temporary action file %s", action_file_name ); - lastdfa = lastnfa = num_rules = numas = numsnpairs = tmpuses = 0; numecs = numeps = eps2 = num_reallocs = hshcol = dfaeql = totnst = 0; numuniq = numdup = hshsave = eofseen = datapos = dataline = 0; diff --git a/modules/libcom/src/flex/flexdef.h b/modules/libcom/src/flex/flexdef.h index 79cfa9427..cf972b274 100644 --- a/modules/libcom/src/flex/flexdef.h +++ b/modules/libcom/src/flex/flexdef.h @@ -350,7 +350,6 @@ extern int yymore_really_used, reject_really_used; * temp_action_file - temporary file to hold actions * backtrack_file - file to summarize backtracking states to * infilename - name of input file - * action_file_name - name of the temporary file * input_files - array holding names of input files * num_input_files - size of input_files array * program_name - name with which program was invoked @@ -359,7 +358,6 @@ extern int yymore_really_used, reject_really_used; extern int datapos, dataline, linenum; extern FILE *skelfile, *yyin, *temp_action_file, *backtrack_file; extern char *infilename; -extern char action_file_name[]; extern char **input_files; extern int num_input_files; extern char *program_name; diff --git a/modules/libcom/src/flex/gen.c b/modules/libcom/src/flex/gen.c index aad884074..d0219ec94 100644 --- a/modules/libcom/src/flex/gen.c +++ b/modules/libcom/src/flex/gen.c @@ -1164,13 +1164,8 @@ void make_tables(void) if ( ferror( temp_action_file ) ) flexfatal( "error occurred when writing temporary action file" ); - else if ( fclose( temp_action_file ) ) - flexfatal( "error occurred when closing temporary action file" ); - - temp_action_file = fopen( action_file_name, "r" ); - - if ( temp_action_file == NULL ) - flexfatal( "could not re-open temporary action file" ); + else if ( fseek( temp_action_file, 0L, SEEK_SET) != 0 ) + flexfatal( "error occurred when rewinding temporary action file" ); /* copy prolog from action_file to output file */ action_out(); diff --git a/modules/libcom/src/misc/truncateFile.c b/modules/libcom/src/misc/truncateFile.c index ccb1450c2..dc074d9fb 100644 --- a/modules/libcom/src/misc/truncateFile.c +++ b/modules/libcom/src/misc/truncateFile.c @@ -27,7 +27,6 @@ */ epicsShareFunc enum TF_RETURN truncateFile (const char *pFileName, unsigned long size) { - char tmpName[256>L_tmpnam?256:L_tmpnam]; long filePos; FILE *pFile; FILE *ptmp; @@ -67,18 +66,10 @@ epicsShareFunc enum TF_RETURN truncateFile (const char *pFileName, unsigned lon return TF_OK; } - epicsTempName ( tmpName, sizeof (tmpName) ); - if ( tmpName[0] == '\0' ) { - fprintf (stderr,"Unable to create tmp file name?\n"); - fclose (pFile); - return TF_ERROR; - } - - ptmp = fopen (tmpName, "w"); + ptmp = epicsTempFile(); if (!ptmp) { fprintf (stderr, - "File access problems to `%s' because `%s'\n", - tmpName, + "File access problems to temp file because `%s'\n", strerror(errno)); fclose (pFile); return TF_ERROR; @@ -89,48 +80,59 @@ epicsShareFunc enum TF_RETURN truncateFile (const char *pFileName, unsigned lon c = getc (pFile); if (c==EOF) { fprintf (stderr, - "File access problems to `%s' because `%s'\n", - pFileName, + "File access problems to temp file because `%s'\n", strerror(errno)); fclose (pFile); fclose (ptmp); - remove (tmpName); return TF_ERROR; } status = putc (c, ptmp); if (status==EOF) { fprintf(stderr, - "File access problems to `%s' because `%s'\n", - tmpName, + "File access problems to temp file because `%s'\n", strerror(errno)); fclose (pFile); fclose (ptmp); - remove (tmpName); return TF_ERROR; } charNo++; } fclose (pFile); - fclose (ptmp); - status = remove (pFileName); - if (status!=TF_OK) { + pFile = fopen(pFileName, "w"); + if (!pFile) { fprintf (stderr, - "Unable to remove `%s' during truncate because `%s'\n", + "File access problems to `%s' because `%s'\n", pFileName, strerror(errno)); - remove (tmpName); + fclose (ptmp); return TF_ERROR; } - status = rename (tmpName, pFileName); - if (status!=TF_OK) { - fprintf (stderr, - "Unable to rename %s to `%s' because `%s'\n", - tmpName, - pFileName, - strerror(errno)); - remove (tmpName); - return TF_ERROR; + rewind (ptmp); + charNo = 0u; + while (charNo strlen ( pName ) ) { - strncpy ( pNameBuf, pName, nameBufLength ); - } - free ( pName ); - } - } -} - // // epicsTmpFile // diff --git a/modules/libcom/src/osi/os/posix/epicsTempFile.cpp b/modules/libcom/src/osi/os/posix/epicsTempFile.cpp index 19b5fb4bc..c015f0418 100644 --- a/modules/libcom/src/osi/os/posix/epicsTempFile.cpp +++ b/modules/libcom/src/osi/os/posix/epicsTempFile.cpp @@ -13,22 +13,6 @@ #define epicsExportSharedSymbols #include "epicsTempFile.h" -extern "C" -epicsShareFunc void epicsShareAPI epicsTempName ( - char * pNameBuf, size_t nameBufLength ) -{ - if ( nameBufLength ) { - pNameBuf[0] = '\0'; - char nameBuf[L_tmpnam]; - if ( tmpnam ( nameBuf ) ) { - if ( nameBufLength > strlen ( nameBuf ) ) { - strncpy ( pNameBuf, nameBuf, nameBufLength ); - } - } - } -} - - extern "C" epicsShareFunc FILE * epicsShareAPI epicsTempFile ( void ) {