]> git.sur5r.net Git - openldap/commitdiff
ITS#8705 fix service pathname
authorHoward Chu <hyc@openldap.org>
Thu, 3 Aug 2017 11:42:21 +0000 (12:42 +0100)
committerHoward Chu <hyc@openldap.org>
Thu, 3 Aug 2017 11:42:21 +0000 (12:42 +0100)
Strip trailing space of last pathname component, if any. Not first.

libraries/liblutil/ntservice.c

index 5e330c480e39805d2c421ec8dad22c0ead9a2a5a..0c10a68f1ef9e95f2fa09703b6a8a5f6a39af4cd 100644 (file)
@@ -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 = ' ';