Merge 3.15 branch into 7.0

First direct merge since 3.16 branch closed.
This commit is contained in:
Andrew Johnson
2018-12-14 17:05:59 -06:00
8 changed files with 69 additions and 90 deletions
+31
View File
@@ -915,6 +915,37 @@ of its CALLBACK objects.</p>
<!-- Insert inherited items immediately below here ... -->
<h3>Routine <tt>epicsTempName()</tt> removed from libCom</h3>
<p>This routine was a simple wrapper around the C89 function <tt>tmpnam()</tt>
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 <tt>epicsTempFile()</tt> instead. We were unable to find any
published code that used this function, so it was removed immediately instead
of being deprecated.</p>
<h3>DBD Parsing of Record Types</h3>
<p>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
<a href="https://bugs.launchpad.net/epics-base/+bug/1801145">Launchpad bug
#1801145</a>.</p>
<h3>menuScan and several record types documented with POD</h3>
<p>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.</p>
<h3>CA client tools learned <tt>-V</tt> option</h3>
<p>This displays the version numbers of EPICS Base and the CA protocol.</p>
<h2 align="center">Changes made between 3.15.5 and 3.15.6</h2>
+3 -11
View File
@@ -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;
-2
View File
@@ -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;
+2 -7
View File
@@ -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();
+33 -31
View File
@@ -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<size) {
c = getc (ptmp);
if (c==EOF) {
fprintf (stderr,
"File access problems to temp file because `%s'\n",
strerror(errno));
fclose (pFile);
fclose (ptmp);
return TF_ERROR;
}
status = putc (c, pFile);
if (status==EOF) {
fprintf(stderr,
"File access problems to `%s' because `%s'\n",
pFileName,
strerror(errno));
fclose (pFile);
fclose (ptmp);
return TF_ERROR;
}
charNo++;
}
fclose(ptmp);
fclose(pFile);
return TF_OK;
}
-1
View File
@@ -20,7 +20,6 @@
extern "C" {
#endif
epicsShareFunc void epicsShareAPI epicsTempName(char *pbuf, size_t bufLen);
epicsShareFunc FILE * epicsShareAPI epicsTempFile(void);
#ifdef __cplusplus
@@ -21,28 +21,6 @@
#define epicsExportSharedSymbols
#include "epicsTempFile.h"
//
// epicsTempName
//
// allow the teporary file directory to be set with the
// TMP environment varianble
//
extern "C"
epicsShareFunc void epicsShareAPI epicsTempName (
char * pNameBuf, size_t nameBufLength )
{
if ( nameBufLength ) {
pNameBuf[0] = '\0';
char * pName = _tempnam ( "c:\\tmp", "epics" );
if ( pName ) {
if ( nameBufLength > strlen ( pName ) ) {
strncpy ( pNameBuf, pName, nameBufLength );
}
free ( pName );
}
}
}
//
// epicsTmpFile
//
@@ -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 )
{