- Fixed a bug in hklscan: core dump when writing to file

- Fixed two small issues with evcontroller: no test for privilege on
  drive
- Many changes to AMOR software.
This commit is contained in:
cvs
2000-06-07 06:11:08 +00:00
parent 82097034d5
commit b7c9700c51
10 changed files with 473 additions and 21 deletions

View File

@ -6,13 +6,20 @@
Mark Koennecke, October 1996
Revised for use with tasker: Mark Koennecke, September 1997
Added code to redirect stdout/sterr to file.
Mark Koennecke, May 2000
Copyright: see copyright.h
----------------------------------------------------------------------------*/
#define NEEDDINTINIT
#include "fortify.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include "conman.h"
#include "SCinter.h"
@ -75,7 +82,8 @@
pNetRead pReader = NULL;
pPerfMon pMon = NULL;
CommandList *pCom;
pid_t myPid;
/* allocate a new server structure */
self = (pServer)malloc(sizeof(SicsServer));
if(!self)
@ -86,6 +94,7 @@
memset(self,0,sizeof(SicsServer));
*pServ = self;
/* configure fortify */
iFortifyScope = Fortify_EnterScope();
Fortify_CheckAllMemory();
@ -119,7 +128,28 @@
return 0;
}
/*
check for option RedirectFile and redirect stout/sterr to it
if present.
*/
pPtr = NULL;
pPtr = IFindOption(pSICSOptions,"RedirectFile");
if(pPtr != NULL)
{
myPid = getpid();
sprintf(pBueffel,"%s%5.5d.log",pPtr,(int)myPid);
fp = freopen(pBueffel,"w",stdout);
if(!fp)
{
printf("Failed to redirect stdout/stderr to %s\n",pBueffel);
}
fp = freopen(pBueffel,"w",stderr);
if(!fp)
{
printf("Failed to redirect stdout/stderr to %s\n",pBueffel);
}
}
/* initialise net reader */
pPtr = NULL;
@ -294,6 +324,14 @@
{
printf("ERROR: Cannot allocate dummy connection, status NOT saved");
}
/* close redirection file if present */
pText = NULL;
pText = IFindOption(pSICSOptions,"RedirectFile");
if(pText)
{
fclose(stderr);
}
/* clean out */
if(pSICSOptions)