T.R | Title | User | Personal Name | Date | Lines |
---|
2159.1 | Code? | XDELTA::HOFFMAN | Steve, OpenVMS Engineering | Wed Apr 23 1997 13:12 | 9 |
|
Can you post the source code to the function?
:Is there a newer version of the OpenVMS V7.1 file correcting this problem?
(I'll assume you know about COMET and the Internet Patch area.)
There are ECO kits out, but none of the released kits appear
to address this particular problem.
|
2159.2 | C++ function code | TAEC::DUHAMEL | Philippe Duhamel, SISB Telecom @VBE DTN 828-5836 | Thu Apr 24 1997 06:13 | 75 |
| You will find hereafter the failing C++ code.
void switch_file ( boolean_t AB_file_switch )
{
char VA_tmp_file[150] ;
char VA_tmp_name[150] ;
char *VA_directory ;
int VI_i ;
/*
* Switch the file and the attribut "file_name"
*/
// search the directory
// (standby and active directories are equal
#ifdef __VMS
VA_directory = strrchr ( VP_standby->EA_file_name, ']' ) ;
#else
VA_directory = strrchr ( VP_standby->EA_file_name, '/' ) ;
#endif // __VMS
for ( VI_i = 0 ; VI_i <= VA_directory - VP_standby->EA_file_name ; VI_i ++ )
VA_tmp_file[VI_i] = VP_standby->EA_file_name[VI_i] ;
sprintf(VA_tmp_file, "%sSS7_RULES.TMP", VA_tmp_file ) ;
// mv standby tmp
if ( AB_file_switch )
rename ( VP_standby->EA_file_name, VA_tmp_file ) ;
strcpy ( VA_tmp_name, VP_standby->EA_file_name ) ;
// mv active standby
if ( AB_file_switch )
rename ( VP_active->EA_file_name, VP_standby->EA_file_name ) ;
strcpy ( VP_standby->EA_file_name, VP_active->EA_file_name ) ;
// mv tmp active
if ( AB_file_switch )
rename ( VA_tmp_file, VP_active->EA_file_name ) ;
strcpy ( VP_active->EA_file_name, VA_tmp_name ) ;
}
cond_value_t ss7_mgt_gtt_switch (
boolean_t file_switch
)
{
TP_set_of_rules VP_tmp_set ;
/*
* Initialize the GTT (if necessary)
*/
if ( !VB_gtt_initialized )
ss7_mgt_gtt_initialize ( CI_FROM_OTHER ) ;
/*
* Switch the file (filename and/or not file)
*/
switch_file ( file_switch ) ;
/*
* Switch the pointer
*/
VP_tmp_set = VP_standby ;
VP_standby = VP_active ;
VP_active = VP_tmp_set ;
/*
* Switch the global section pointers
*/
VP_stb_global_section = VP_standby->EP_gtt_gs ;
VP_act_global_section = VP_active->EP_gtt_gs ;
return ( SS7$_NORMAL ) ;
}
|
2159.3 | | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Thu Apr 24 1997 09:11 | 40 |
| Some comments...
> for ( VI_i = 0 ; VI_i <= VA_directory - VP_standby->EA_file_name ; VI_i ++ )
> VA_tmp_file[VI_i] = VP_standby->EA_file_name[VI_i] ;
This could be written more simply as
memcpy(VA_tmp_file, VP_standby->EA_file_name,
(VA_directory - VP_standby->EA_file_name + 1));
> sprintf(VA_tmp_file, "%sSS7_RULES.TMP", VA_tmp_file ) ;
This is skating pretty close to the edge -- you're both reading and writing
VA_tmp_file in this call. I suspect it is supported, but it makes me
uncomfortable. (If you had sprintf(X, "A%sBCDEF", X) it would definitely
not be supported.) This could be written more simply as
strcat(VA_tmp_file, "SS7_RULES.TMP");
You don't check the status of any of your rename() calls. I suspect the
real problem is that one or more of them is failing. Without the status
it's hard to know why.
The interleaved rename() and strcpy() calls were confusing, because I didn't
at first see the difference between VA_tmp_file (which is the file name to
use as an intermediate in the rename() calls) and VA_tmp_name (which is just
a buffer used for swapping name strings). It would have been clearer to me
if you had written
// swap the actual files standby->tmp; active->standby; tmp->active
if ( AB_file_switch ) {
rename ( VP_standby->EA_file_name, VA_tmp_file ) ;
rename ( VP_active->EA_file_name, VP_standby->EA_file_name ) ;
rename ( VA_tmp_file, VP_active->EA_file_name ) ;
}
// swap the name strings.
strcpy ( VA_tmp_name, VP_standby->EA_file_name ) ;
strcpy ( VP_standby->EA_file_name, VP_active->EA_file_name ) ;
strcpy ( VP_active->EA_file_name, VA_tmp_name ) ;
|
2159.4 | Comments... | XDELTA::HOFFMAN | Steve, OpenVMS Engineering | Thu Apr 24 1997 12:28 | 24 |
|
In addition to checking the rename status...
: char VA_tmp_file[150] ;
: char VA_tmp_name[150] ;
OpenVMS file specifications can currently be up to 255 characters,
and this value may increase. (NAM$C_MAXRSS is one constant in this
area.)
:#ifdef __VMS
: VA_directory = strrchr ( VP_standby->EA_file_name, ']' ) ;
:#else
: VA_directory = strrchr ( VP_standby->EA_file_name, '/' ) ;
:#endif // __VMS
OpenVMS will accept UNIX-format file specifications.
Also, the "]" and the ">" are the directory end delimiters.
:You will find hereafter the failing C++ code.
Also see TURRIS::C_PLUS_PLUS -- though this doesn't immediately
look like it's a C vs C++ issue...
|
2159.5 | | DECC::OUELLETTE | mudseason into blackfly season | Thu Apr 24 1997 21:12 | 5 |
| Also, I'd use mumble$PARSE to pick apart the file name.
You may not see a ] or a > in a complicated file name like DECC::foo.bar or
sys$library:decc$rtldef.tlb. This all gets much more complicated when
VMS adds funny filenames with funny characters in them and then you
really need to use the $PARSE function to get it right.
|
2159.6 | Code improved, but DECC$SHR.EXE problem remains | TAEC::DUHAMEL | Philippe Duhamel, SISB Telecom @VBE DTN 828-5836 | Fri Apr 25 1997 05:48 | 7 |
| Thank you all three for your contribution to our code improvement! Your changes
suggestions have been implemented. Unfortunately they did not solve the problem.
I was not able to find more information in the C++ conference.
Now its seems that the problem is on the DECC$SHR.EXE side, as the OpenVMS V6.2
version of this file corrects the behaviour we found with the OpenVMS V7.1 one.
|
2159.7 | Tools To Localize Fault... | XDELTA::HOFFMAN | Steve, OpenVMS Engineering | Fri Apr 25 1997 12:14 | 16 |
|
Did you work through the new code in the debugger, to determine more
about what is going on in the application? (I will assume you are
now checking and reporting errors in the completion status from the
rename operations, and any other operations that return completion
status values.)
Have you considered using full security auditing to track the activity
of the programs? And have you considered using the XQP monitoring
during a program run? (Use "SET WATCH/CLASS=ALL FILE" to enable, and
use "SET WATCH/CLASS=NONE FILE" to disable. Requires CMKRNL.)
Also consider replacing the rename operation with the lib$rename_file
RTL call -- this technique will tend to either eliminate or implicate
the DECC$SHR as the culprit.
|