From: Howard Chu Date: Thu, 3 Aug 2017 11:42:21 +0000 (+0100) Subject: ITS#8705 fix service pathname X-Git-Tag: OPENLDAP_REL_ENG_2_4_46~91 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=00d14ac89046f26fbee93d910c17c5877cd7debe;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 = ' ';