[cpp-sp COMMIT] /branches/REL_2/shibd/shibd_win32.cpp

noreply at shibboleth.net noreply at shibboleth.net
Wed Jun 6 20:43:48 BST 2012


Author: scantor
Date: Wed Jun  6 20:43:48 2012
New Revision: 3694

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3694&view=rev
Log:
Add stdin/stdout to service cmd

Modified:
    branches/REL_2/shibd/shibd_win32.cpp

Modified: branches/REL_2/shibd/shibd_win32.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibd/shibd_win32.cpp?rev=3694&r1=3693&r2=3694&view=diff
==============================================================================
--- branches/REL_2/shibd/shibd_win32.cpp (original)
+++ branches/REL_2/shibd/shibd_win32.cpp Wed Jun  6 20:43:48 2012
@@ -47,6 +47,8 @@
 char                    szErr[256];
 LPCSTR                  lpszInstall = nullptr;
 LPCSTR                  lpszRemove = nullptr;
+LPCSTR                  lpszStdout = nullptr;
+LPCSTR                  lpszStderr = nullptr;
 
 // internal function prototypes
 VOID WINAPI service_ctrl(DWORD dwCtrlCode);
@@ -99,13 +101,17 @@
         }
         else if (_stricmp("stdout", argv[i]+1) == 0)
         {
-            if (argc > ++i)
-                freopen(argv[i++], "a+", stdout);
+            if (argc > ++i) {
+                lpszStdout = argv[i++];
+                freopen(lpszStdout, "a+", stdout);
+            }
         }
         else if (_stricmp("stderr", argv[i]+1) == 0)
         {
-            if (argc > ++i)
-                freopen(argv[i++], "a+", stderr);
+            if (argc > ++i) {
+                lpszStderr = argv[i++];
+                freopen(lpszStderr, "a+", stderr);
+            }
         }
         else if (_stricmp( "console", argv[i]+1) == 0)
         {
@@ -381,6 +387,10 @@
         cmd = cmd + " -config " + shar_config;
     if (shar_schemadir)
         cmd = cmd + " -schemadir " + shar_schemadir;
+    if (lpszStdout)
+        cmd = cmd + " -stdout " + lpszStdout;
+    if (lpszStderr)
+        cmd = cmd + " -stderr " + lpszStderr;
 
     schSCManager = OpenSCManager(
                         nullptr,                   // machine (nullptr == local)



More information about the commits mailing list