diff options
Diffstat (limited to 'runtime/nssel.c')
-rw-r--r-- | runtime/nssel.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/runtime/nssel.c b/runtime/nssel.c index 751dae9..533d92b 100644 --- a/runtime/nssel.c +++ b/runtime/nssel.c @@ -9,7 +9,7 @@ * * Work on this module begun 2008-04-22 by Rainer Gerhards. * - * Copyright 2008-2012 Adiscon GmbH. + * Copyright 2008-2014 Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -107,6 +107,7 @@ CODESTARTobjDestruct(nssel) * a driver name string as load indicator (because we also need that string * to release the driver */ + free(pThis->pBaseDrvrName); if(pThis->pDrvrName != NULL) { obj.ReleaseObj(__FILE__, pThis->pDrvrName+2, DONT_LOAD_LIB, (void*) &pThis->Drvr); free(pThis->pDrvrName); @@ -127,6 +128,29 @@ finalize_it: } +/* set the base driver name. If the driver name + * is set to NULL, the previously set name is deleted but + * no name set again (which results in the system default being + * used)-- rgerhards, 2008-05-05 + */ +static rsRetVal +SetDrvrName(nssel_t *pThis, uchar *pszName) +{ + DEFiRet; + ISOBJ_TYPE_assert(pThis, netstrms); + if(pThis->pBaseDrvrName != NULL) { + free(pThis->pBaseDrvrName); + pThis->pBaseDrvrName = NULL; + } + + if(pszName != NULL) { + CHKmalloc(pThis->pBaseDrvrName = (uchar*) strdup((char*) pszName)); + } +finalize_it: + RETiRet; +} + + /* Add a stream object to the current select() set. * Note that a single stream may have multiple "sockets" if * it is a listener. If so, all of them are begin added. @@ -195,6 +219,7 @@ CODESTARTobjQueryInterface(nssel) pIf->Construct = nsselConstruct; pIf->ConstructFinalize = ConstructFinalize; pIf->Destruct = nsselDestruct; + pIf->SetDrvrName = SetDrvrName; pIf->Add = Add; pIf->Wait = Wait; pIf->IsReady = IsReady; |