aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Redirect stdin *before* we establish a listen socketEric Wong2007-09-051-29/+0
| | | | | | This way we'll avoid listening on fd=0 and have a better chance of having fd=0 as /dev/null git-svn-id: https://svn.musicpd.org/mpd/trunk@6852 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: oops, fix a syntax errorEric Wong2007-09-041-1/+1
| | | | | (yes, it helps to actually compile code before committing it) git-svn-id: https://svn.musicpd.org/mpd/trunk@6851 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: better bug avoidance for libraries incorrectly handling fd=0Eric Wong2007-09-041-2/+16
| | | | | | | | | | | | | We redirect stdin to /dev/null to work around a libao bug, but this bug has been fixed in libao since 2003 (according to jat). However, there are likely other bugs in other libraries (and even our code!) that handle fd=0 incorrectly and I'd rather not take the risk[1]. So So it's easiest to just keep fd=0==/dev/null for now... [1] - I've seen several of these myself... git-svn-id: https://svn.musicpd.org/mpd/trunk@6849 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix endless loop when mpd is launched from a non-interactive shell.Eric Wong2007-09-021-1/+5
| | | | | | | | | | | | | | | | | | Thanks to _noth_ for the patch, this fixes Mantis bug #1534 _noth_ wrote: > When MPD is launched from a non-interactive shell, it enters an endless > loop, filling up its error log file with "error accept()'ing" messages. > This is caused by the fact that stdin is already closed when mpd starts > up. listenOnPort() opens up the first of its sockets as fd 0 (the first > empty fd table position). Then, setup_log_output()->redirect_stdin() > overwrites fd0 (fd=open("/dev/null",...); dup2(fd, STDIN_FILENO);) > without checking if it corresponds to the actual standard input (or if > it is open in the first place). This means that listenSockets[0].fd now > is a fd for /dev/null, thus doIOForInterfaces()->getConnections() can't > accept(2) on it and fails with the above error. The attached patch fixes > this for me. git-svn-id: https://svn.musicpd.org/mpd/trunk@6843 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: cleanup: avoid "magic" numbersEric Wong2007-08-281-6/+8
| | | | | | We used a bare '15' in several places and it's not immediately obvious where it came from. This makes it more obvious git-svn-id: https://svn.musicpd.org/mpd/trunk@6829 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: flush the warning log after redirecting stderr to the log filesJ. Alexander Treuman2007-06-291-0/+1
| | | | | | | | | | Previously, the warning log was only flushed if creating the db or logging to stdout. This meant that under normal circumstances (no db creation, logging to files) the warning log was never flushed. This caused a bug when a warning was printed for each call to the status command where the warning buffer would grow endlessly, eventually using more and more CPU to reallocate it. git-svn-id: https://svn.musicpd.org/mpd/trunk@6660 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* More (v)snprintf-related buffer over-allocations removedEric Wong2007-02-191-1/+1
| | | | | Also took out an unnecessary memset in getPlayerErrorStr git-svn-id: https://svn.musicpd.org/mpd/trunk@5396 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Re-adding a fix to log.c that got pulled with the localization reversion.J. Alexander Treuman2007-02-181-5/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5374 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Reverting all of my localization changes. It was a horribleJ. Alexander Treuman2007-02-181-19/+8
| | | | | | implementation, and fixing it is a big enough job that I don't know when I'll get around to it. Probably best just starting from scratch anyhow. git-svn-id: https://svn.musicpd.org/mpd/trunk@5373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-5/+5
| | | | | | | | Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Output warning messages in the current locale's charset.J. Alexander Treuman2007-01-081-1/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5229 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fixed some silly logic that caused an extra \n to be printed when flushingJ. Alexander Treuman2007-01-081-5/+4
| | | | | warning messages. git-svn-id: https://svn.musicpd.org/mpd/trunk@5228 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Convert log messages sent to stdout to the current locale's charset.J. Alexander Treuman2007-01-081-2/+11
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* cleanup flushWarningBuffer() and make some for() loops in audio.c look and ↵Warren Dukes2006-10-031-10/+16
| | | | | do something sane. git-svn-id: https://svn.musicpd.org/mpd/trunk@4867 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* get rid of the pointless xopen wrapper, open(2) does not throw errno = EINTREric Wong2006-08-221-4/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4663 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* always support DEBUG() logging, even if -DNDEBUGWarren Dukes2006-08-121-3/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4613 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: oops, brain fart caused a segfaultEric Wong2006-08-031-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4538 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: switch to using FILE * for logging, since fdprintf isn't reentrantEric Wong2006-08-031-12/+15
| | | | | | | | (and fdprintf was never meant to be reentrant, either) A huge thanks to welshbyte for reporting the bug and being very helpful in helping me fix it. git-svn-id: https://svn.musicpd.org/mpd/trunk@4537 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* logging cleanupsEric Wong2006-08-011-33/+195
| | | | | | | | | | | | | | * Moved all logging-related stuff into log.c (and not myfprintf.c) * ISO C90-compliant strftime usage: %e and %R replaced with %d and %H:%M respectively * Got rid of variadic macros since some old-school compilers don't like them * compiling with -DNDEBUG disables the DEBUG() macro git-svn-id: https://svn.musicpd.org/mpd/trunk@4512 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove deprecated myfprintf wrapperEric Wong2006-07-301-1/+1
| | | | | | | This shaves another 5-6k because we've removed the paranoid fflush() calls after every fprintf. Now we only fflush() when we need to git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-25/+30
| | | | | | Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* if no audioOutput specified, we no attempt to detect if there exists a ↵Warren Dukes2005-03-121-0/+3
| | | | | usable oss or alsa device git-svn-id: https://svn.musicpd.org/mpd/trunk@3057 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* merge shank-rewrite-config changesWarren Dukes2004-10-281-4/+12
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add WARNING log method. it's the same as ERROR, except that when mpd starts,Warren Dukes2004-06-121-1/+40
| | | | | | warnings are buffered until the error log is opened, and then flushed to the error log. git-svn-id: https://svn.musicpd.org/mpd/trunk@1442 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add vim shiznit to end of all source filesWarren Dukes2004-04-141-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* import from SF CVSWarren Dukes2004-02-231-0/+39
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f