[ofw] RE: NDinstall - return proper exit code.

Sean Hefty sean.hefty at intel.com
Wed Jul 15 10:56:51 PDT 2009


>-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;

We probably want to return err_no here.

> }
>
> /*
>@@ -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;

Same - plus this logic looks a little complex.  It may be simpler to just bail
earlier on the first error

- Sean




More information about the ofw mailing list