From dd89498e85b369dd391c61215eb4e3c155dbf744 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 28 Oct 1999 07:18:48 +0000 Subject: [PATCH] Fix misc syntax warnings and/or bugs. See README 1.27 log --- clients/ud/group.c | 2 ++ libraries/liblutil/getopt.c | 2 ++ libraries/liblutil/ntservice.c | 18 +++++++++--------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/clients/ud/group.c b/clients/ud/group.c index 950631d765..98936c7886 100644 --- a/clients/ud/group.c +++ b/clients/ud/group.c @@ -239,10 +239,12 @@ remove_group( char *name ) } ldap_uncache_entry(ld, dn); if (verbose) + { if (name == NULL) printf(" The group has been removed.\n"); else printf(" The group \"%s\" has been removed.\n", name); + } Free(dn); return; } diff --git a/libraries/liblutil/getopt.c b/libraries/liblutil/getopt.c index 3b0ca476a5..ac63dbdae4 100644 --- a/libraries/liblutil/getopt.c +++ b/libraries/liblutil/getopt.c @@ -59,6 +59,7 @@ int getopt (int argc, char * const argv [], const char * opts) printf("DF_TRACE_DEBUG: int getopt () in getopt.c\n"); #endif if (sp == 1) + { if (optind >= argc || argv[optind][0] != sw || argv[optind][1] == eos) return EOF; @@ -67,6 +68,7 @@ printf("DF_TRACE_DEBUG: int getopt () in getopt.c\n"); optind++; return EOF; } + } c = argv[optind][sp]; optopt = (int) c; if (c == arg || (cp = strchr(opts,c)) == NULL) diff --git a/libraries/liblutil/ntservice.c b/libraries/liblutil/ntservice.c index e1554a5cb4..9552082d47 100644 --- a/libraries/liblutil/ntservice.c +++ b/libraries/liblutil/ntservice.c @@ -76,13 +76,13 @@ int srv_install(LPCTSTR lpszServiceName, LPCTSTR lpszBinaryPathName) "REG_SZ", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) != ERROR_SUCCESS) { - fprintf( stderr, "RegCreateKeyEx() failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "RegCreateKeyEx() failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); RegCloseKey(hKey); return(0); } if ( RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ, lpszBinaryPathName, strlen(lpszBinaryPathName) + 1) != ERROR_SUCCESS) { - fprintf( stderr, "RegSetValueEx(EventMessageFile) failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "RegSetValueEx(EventMessageFile) failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); RegCloseKey(hKey); return(0); } @@ -90,7 +90,7 @@ int srv_install(LPCTSTR lpszServiceName, LPCTSTR lpszBinaryPathName) dwValue = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; if ( RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD, (LPBYTE) &dwValue, sizeof(DWORD)) != ERROR_SUCCESS) { - fprintf( stderr, "RegCreateKeyEx(TypesSupported) failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "RegCreateKeyEx(TypesSupported) failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); RegCloseKey(hKey); return(0); } @@ -99,13 +99,13 @@ int srv_install(LPCTSTR lpszServiceName, LPCTSTR lpszBinaryPathName) } else { - fprintf( stderr, "CreateService() failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "CreateService() failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); CloseServiceHandle(schSCManager); return(0); } } else - fprintf( stderr, "OpenSCManager() failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "OpenSCManager() failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); return(0); } @@ -125,20 +125,20 @@ int srv_remove(LPCTSTR lpszServiceName, LPCTSTR lpszBinaryPathName) CloseServiceHandle(schSCManager); return(1); } else { - fprintf( stderr, "DeleteService() failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "DeleteService() failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); fprintf( stderr, "The %s service has not been removed.\n", lpszBinaryPathName); CloseServiceHandle(schService); CloseServiceHandle(schSCManager); return(0); } } else { - fprintf( stderr, "OpenService() failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "OpenService() failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); CloseServiceHandle(schSCManager); return(0); } } else - fprintf( stderr, "OpenSCManager() failed. GetLastError=%d (%s)\n", GetLastError(), GetLastErrorString() ); + fprintf( stderr, "OpenSCManager() failed. GetLastError=%lu (%s)\n", GetLastError(), GetLastErrorString() ); return(0); } @@ -335,7 +335,7 @@ void LogSlapdStartedEvent( char *svc, int slap_debug, char *configfile, char *ur Inserts[i++] = ldap_pvt_strdup( is_NT_Service ? "svc" : "cmd" ); ReportEvent( hEventLog, EVENTLOG_INFORMATION_TYPE, 0, - MSG_SLAPD_STARTED, NULL, i, 0, Inserts, NULL ); + MSG_SLAPD_STARTED, NULL, i, 0, (LPCSTR *) Inserts, NULL ); for ( j = 0; j < i; j++ ) ldap_memfree( Inserts[j] ); -- 2.39.5