I've attached the patch that Ted mentioned.

Looking over the bug report, I see I could have made the reason the software fails to run clearer.

When twlog is run it searches for $HOME/.twlogDir and $HOME/.twlogDir/logfile. If these are not found, it writes an error message to stderr and exits.

Launching the program from the GUI, it looks like nothing happened. The only way I found what was happening was by running the program from the command line in an x-term window.

I think the simplest fix is for this issue is for twlog to just make the directory and file that it needs.

--
Jacob
diff -Naur twlog-2.3/src/twlog.c twlog-2.3-jla/src/twlog.c
--- twlog-2.3/src/twlog.c       2006-03-01 16:12:55.000000000 -0700
+++ twlog-2.3-jla/src/twlog.c   2007-03-26 21:15:37.607856959 -0600
@@ -182,19 +182,21 @@
 
    strcpy (dirpath, getenv ("HOME"));   /* $HOME to dir path */
    strcat (dirpath, LOGDIR);            /* then add LOGDIR   */
-   if (stat (dirpath, &buf) == -1)      /* does $HOME/LOGDIR exist? */
+   if (stat (dirpath, &buf) == -1      /* does $HOME/LOGDIR exist? */
+       && mkdir (dirpath, S_IRWXU) == -1) /* or try to create it */
    {
       perror ("twlog");
-      fprintf (stderr, "twlog: Can't find log directory %s\n", dirpath);
+      fprintf (stderr, "twlog: Can't create log directory %s\n", dirpath);
       exit (1);
    }
 
    strcpy (logpath, dirpath);   /* dirpath to logpath */
    strcat (logpath, LOGFILE);   /* add LOGFILE name   */
-   if (stat (logpath, &buf) == -1)      /* and check that it exists */
+   if (stat (logpath, &buf) == -1 /* and check that it exists */
+       && creat(logpath, S_IRUSR|S_IWUSR) == -1) /* or try to create it */ 
    {
       perror ("twlog");
-      fprintf (stderr, "twlog: Can't find %s\n", logpath);
+      fprintf (stderr, "twlog: Can't create initial log file %s\n", logpath);
       exit (1);
    }
 

Reply via email to