Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Redirect stderr to the log file.

  • Loading branch information...
commit 31d3818cd3df623d54d2a402f83bf33a8c7dfd8f 1 parent 6bde761
Tilman Sauerbeck authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 src/xmms2-scrobbler.c
View
26 src/xmms2-scrobbler.c
@@ -722,6 +722,30 @@ main_loop ()
}
}
+static void
+start_logging ()
+{
+ int fd;
+ const char *dir;
+ char buf[XMMS_PATH_MAX];
+
+ dir = xmmsc_userconfdir_get (buf, sizeof (buf));
+
+ if (!dir) {
+ fprintf (stderr, "cannot get userconfdir\n");
+ return;
+ }
+
+ chdir (dir);
+
+ fd = creat ("clients/xmms2-scrobbler/logfile.log", 0640);
+
+ if (fd > -1) {
+ /* redirect stderr to the log file. */
+ dup2 (fd, 2);
+ }
+}
+
int
main (int argc, char **argv)
{
@@ -734,6 +758,8 @@ main (int argc, char **argv)
sig.sa_handler = &signal_handler;
sigaction (SIGINT, &sig, 0);
+ start_logging ();
+
if (!load_config ())
return EXIT_FAILURE;
Please sign in to comment.
Something went wrong with that request. Please try again.