RTEMS: don't fault when no startup script is provided
epicsRtemsFSImage=NULL is the documented "none is needed" case, and it is the one initialize_local_filesystem() success path that leaves argv[1] unset, so set_directory() reached strrchr(NULL, '/') and killed the guest before main(). Same defect in the score/ and posix/ inits.
This commit is contained in:
1 parent
8770f172fc
commit
e64d981e8f
2 files changed
+16
-6
No files matched your search
@@ -1251,8 +1251,13 @@ POSIX_Init ( void *argument __attribute__((unused)))
|
||||
|
||||
printf ("***** Preparing EPICS application *****\n");
|
||||
iocshRegisterRTEMS ();
|
||||
set_directory (argv[1]);
|
||||
epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]);
|
||||
/* No startup script when the application declares that it needs no
|
||||
* filesystem (epicsRtemsFSImage == NULL).
|
||||
*/
|
||||
if (argv[1] != NULL) {
|
||||
set_directory (argv[1]);
|
||||
epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]);
|
||||
}
|
||||
atexit(exitHandler);
|
||||
printf ("***** Starting EPICS application *****\n");
|
||||
|
||||
@@ -1270,7 +1275,7 @@ POSIX_Init ( void *argument __attribute__((unused)))
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
result = main ((sizeof argv / sizeof argv[0]) - 1, argv);
|
||||
result = main (argv[1] != NULL ? 2 : 1, argv);
|
||||
printf ("***** IOC application terminating *****\n");
|
||||
epicsThreadSleep(1.0);
|
||||
epicsExit(result);
|
||||
|
||||
@@ -681,11 +681,16 @@ Init (rtems_task_argument ignored)
|
||||
*/
|
||||
printf ("***** Preparing EPICS application *****\n");
|
||||
iocshRegisterRTEMS ();
|
||||
set_directory (argv[1]);
|
||||
epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]);
|
||||
/* No startup script when the application declares that it needs no
|
||||
* filesystem (epicsRtemsFSImage == NULL).
|
||||
*/
|
||||
if (argv[1] != NULL) {
|
||||
set_directory (argv[1]);
|
||||
epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]);
|
||||
}
|
||||
atexit(exitHandler);
|
||||
printf ("***** Starting EPICS application *****\n");
|
||||
result = main ((sizeof argv / sizeof argv[0]) - 1, argv);
|
||||
result = main (argv[1] != NULL ? 2 : 1, argv);
|
||||
printf ("***** IOC application terminating *****\n");
|
||||
epicsThreadSleep(1.0);
|
||||
epicsExit(result);
|
||||
|
||||
Reference in new issue
Block a user