On Sun, 19 Dec 1999, brian j pardy wrote:

> Yep, it was my fault.  Here's a patch.  Not intentionally obfuscated,
> but diff decided to do it this way.
> 
> The old way:
> 
>     if (dump_output_immediately) {
>         if (LYCookieSaveFile != NULL) {
>                 [tilde expand LYCookieSaveFile]
>             }
>         } else {
>             StrAllocCopy(LYCookieSaveFile, "/dev/null");
>         }
>     } else {
>         if (LYCookieSaveFile == NULL) {
>             StrAllocCopy(LYCookieSaveFile, LYCookieFile);
>         }
>     }
> 
> Now it attempts to expand LYCookieSaveFile before it worries about what
> mode we're in.
> 
> diff -ru 2.8.3dev.17/src/LYMain.c 2.8.3dev.17.bri/src/LYMain.c

De-obfuscated by keeping only surviving lines:

> @@ -1605,29 +1605,28 @@
>       LYLoadCookies(LYCookieFile);
>      }
>  
> +    /* tilde-expand LYCookieSaveFile */
> +    if (LYCookieSaveFile != NULL) {
> +     if (LYCookieSaveFile[0] == '~' && LYCookieSaveFile[1] == '/' &&
> +       LYCookieSaveFile[2] != '\0') {
> +         temp = NULL;
> +         StrAllocCopy(temp, LYCookieSaveFile + 2);
> +         StrAllocCopy(LYCookieSaveFile, wwwName(Home_Dir()));
> +         LYAddPathSep(&LYCookieSaveFile);
> +         StrAllocCat(LYCookieSaveFile, temp);
> +         FREE(temp);
> +     }
> +    }
> +
>      /*
>       * In dump_output_immediately mode, LYCookieSaveFile defaults to
>       * /dev/null, otherwise it defaults to LYCookieFile.
>       */
> +    if(dump_output_immediately) {

The following is now happening unconditionally for dump_output_immediately,
even if a COOKIE_SAVE_FILE was explicitly given, that is overridden here:

>           StrAllocCopy(LYCookieSaveFile, "/dev/null");

Maybe I de-obfuscated wrongly.  The /dev/null thing should be subject to
'if (LYCookieSaveFile == NULL)', just like the non-d_o_i alternative below.

>      } else {
> +     if (LYCookieSaveFile == NULL)
>           StrAllocCopy(LYCookieSaveFile, LYCookieFile);
>      }
>  #endif

   Klaus

Reply via email to