diff options
author | Colin Watson <cjwatson@debian.org> | 2013-09-14 23:42:11 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2013-09-14 23:42:11 +0100 |
commit | 327155e6824b3ee13837bdde04e4eb47e147ff46 (patch) | |
tree | 8f8743122403c7a2e6ed919156711fb1520c657f /log.c | |
parent | 0334ce32304e9ba2a10ee5ca49ca6e8ff3ba6cf4 (diff) | |
parent | 74e339b8f8936bc0d985e053a076d0c9b5e9ea51 (diff) |
* New upstream release (http://www.openssh.com/txt/release-6.3).
- sftp(1): add support for resuming partial downloads using the "reget"
command and on the sftp commandline or on the "get" commandline using
the "-a" (append) option (closes: #158590).
- ssh(1): add an "IgnoreUnknown" configuration option to selectively
suppress errors arising from unknown configuration directives (closes:
#436052).
- sftp(1): update progressmeter when data is acknowledged, not when it's
sent (partially addresses #708372).
- ssh(1): do not fatally exit when attempting to cleanup multiplexing-
created channels that are incompletely opened (closes: #651357).
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: log.c,v 1.43 2012/09/06 04:37:39 dtucker Exp $ */ | 1 | /* $OpenBSD: log.c,v 1.45 2013/05/16 09:08:41 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -38,6 +38,7 @@ | |||
38 | 38 | ||
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | 40 | ||
41 | #include <fcntl.h> | ||
41 | #include <stdarg.h> | 42 | #include <stdarg.h> |
42 | #include <stdio.h> | 43 | #include <stdio.h> |
43 | #include <stdlib.h> | 44 | #include <stdlib.h> |
@@ -54,6 +55,7 @@ | |||
54 | 55 | ||
55 | static LogLevel log_level = SYSLOG_LEVEL_INFO; | 56 | static LogLevel log_level = SYSLOG_LEVEL_INFO; |
56 | static int log_on_stderr = 1; | 57 | static int log_on_stderr = 1; |
58 | static int log_stderr_fd = STDERR_FILENO; | ||
57 | static int log_facility = LOG_AUTH; | 59 | static int log_facility = LOG_AUTH; |
58 | static char *argv0; | 60 | static char *argv0; |
59 | static log_handler_fn *log_handler; | 61 | static log_handler_fn *log_handler; |
@@ -345,6 +347,20 @@ log_is_on_stderr(void) | |||
345 | return log_on_stderr; | 347 | return log_on_stderr; |
346 | } | 348 | } |
347 | 349 | ||
350 | /* redirect what would usually get written to stderr to specified file */ | ||
351 | void | ||
352 | log_redirect_stderr_to(const char *logfile) | ||
353 | { | ||
354 | int fd; | ||
355 | |||
356 | if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) { | ||
357 | fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile, | ||
358 | strerror(errno)); | ||
359 | exit(1); | ||
360 | } | ||
361 | log_stderr_fd = fd; | ||
362 | } | ||
363 | |||
348 | #define MSGBUFSIZ 1024 | 364 | #define MSGBUFSIZ 1024 |
349 | 365 | ||
350 | void | 366 | void |
@@ -430,7 +446,7 @@ do_log(LogLevel level, const char *fmt, va_list args) | |||
430 | log_handler = tmp_handler; | 446 | log_handler = tmp_handler; |
431 | } else if (log_on_stderr) { | 447 | } else if (log_on_stderr) { |
432 | snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); | 448 | snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); |
433 | write(STDERR_FILENO, msgbuf, strlen(msgbuf)); | 449 | (void)write(log_stderr_fd, msgbuf, strlen(msgbuf)); |
434 | } else { | 450 | } else { |
435 | #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) | 451 | #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) |
436 | openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); | 452 | openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); |