[ofw] NDinstall - return proper exit code.

Smith, Stan stan.smith at intel.com
Wed Jul 15 10:50:00 PDT 2009


Signed off by stan.smith at intel.com


--- C:/Documents and Settings/scsmith/Local Settings/Temp/installsp.c-revBASE.svn000.tmp.c      Wed Jul 15 10:37:41 2009
+++ C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/tools/ndinstall/user/installsp.c       Wed Jul 15 10:38:59 2009
@@ -163,7 +163,7 @@
  * Windows Sockets Direct Components".
  * The direct link is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/network/hh/network/wsdp_2xrb.asp
  */
-static void install_provider(void)
+static int install_provider(void)
 {
        int rc;
        INT err_no;
@@ -213,7 +213,9 @@
                        printf("WSCInstallProvider failed: %d\n", err_no);
        } else {
                printf("successful\n");
+               rc = 0;
        }
+       return rc;
 }

 /*
@@ -222,18 +224,19 @@
  */
 static void remove_provider(void)
 {
-       int rc;
+       int rc=0,rc1;
        int err_no;
        LONG reg_error;
        HKEY hkey;

        /* Remove from the catalog */
        printf("\nRemoving %s provider: ", provider_name[index]);
-       rc = WSCDeinstallProvider(&provider_guid[index], &err_no);
-       if (rc == SOCKET_ERROR) {
+       rc1 = WSCDeinstallProvider(&provider_guid[index], &err_no);
+       if (rc1 == SOCKET_ERROR) {
                printf ("WSCDeinstallProvider failed: %d\n", err_no);
        } else {
                printf ("successful\n");
+               rc1 = 0;
        }

 #ifdef _WIN64
@@ -244,8 +247,12 @@
                printf ("WSCDeinstallProvider32 failed: %d\n", err_no);
        } else {
                printf ("successful\n");
+               rc = 0;
        }
 #endif /* _WIN64 */
+       if ( rc || rc1 )
+               return (rc ? rc : rc1);
+       return 0;
 }

 static int get_prov_index(char *name)
@@ -305,14 +312,14 @@
        }

        if (install) {
-               install_provider();
+               ret = install_provider();
 #ifdef PERFMON_ENABLED
                _IBSPPerfmonIniFilesGenerate();
                if ( _IBSPPerfmonRegisterKeys() == ERROR_SUCCESS )
                                _IBSPPerfmonRegisterCounters();
 #endif
        } else if (remove) {
-               remove_provider();
+               ret = remove_provider();
 #ifdef PERFMON_ENABLED
                _IBSPPerfmonIniFilesRemove();
                if ( _IBSPPerfmonDeregisterCounters() == ERROR_SUCCESS )



More information about the ofw mailing list