Or maybe this one instead, which adds 'x' to the fopen call to prevent
webalizer from overwriting existing .htaccess files.

-- 
Robert Millan

ACK STORM, S.L.  -  http://www.ackstorm.es/
diff -ur webalizer-2.01.10.old/output.c webalizer-2.01.10/output.c
--- webalizer-2.01.10.old/output.c	2007-02-19 12:23:57.000000000 +0100
+++ webalizer-2.01.10/output.c	2007-02-19 12:25:47.000000000 +0100
@@ -2590,6 +2590,15 @@
    /* now do html stuff... */
    snprintf(index_fname,sizeof(index_fname),"index.%s",html_ext);
 
+   if ( (out_fp=fopen(".htaccess","wx")) == NULL)
+   {
+      if (verbose)
+      fprintf(stderr,"%s .htaccess!\n",_("Error: Unable to open file"));
+      return 1;
+   }
+   fprintf(out_fp,"DirectoryIndex %s\n",index_fname);
+   fclose(out_fp);
+
    if ( (out_fp=open_out_file(index_fname)) == NULL)
    {
       if (verbose)

Reply via email to