From: Howard Chu Date: Thu, 3 Aug 2017 11:42:21 +0000 (+0100) Subject: ITS#8705 fix service pathname X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=af92b8d2caa7f3a27ea8721cdaf75d8b8a3c79ff;p=openldap ITS#8705 fix service pathname Strip trailing space of last pathname component, if any. Not first. --- diff --git a/libraries/liblutil/ntservice.c b/libraries/liblutil/ntservice.c index 5e330c480e..0c10a68f1e 100644 --- a/libraries/liblutil/ntservice.c +++ b/libraries/liblutil/ntservice.c @@ -58,8 +58,9 @@ int lutil_srv_install(LPCTSTR lpszServiceName, LPCTSTR lpszDisplayName, HKEY hKey; DWORD dwValue, dwDisposition; SC_HANDLE schSCManager, schService; - char *sp = strchr( lpszBinaryPathName, ' '); + char *sp = strrchr( lpszBinaryPathName, '\\'); + if ( sp ) sp = strchr(sp, ' '); if ( sp ) *sp = '\0'; fprintf( stderr, "The install path is %s.\n", lpszBinaryPathName ); if ( sp ) *sp = ' ';