Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src ctime can return NULL
details: https://anonhg.NetBSD.org/src/rev/134bd40afd2b
branches: trunk
changeset: 753622:134bd40afd2b
user: christos <christos%NetBSD.org@localhost>
date: Sun Apr 04 01:36:03 2010 +0000
description:
ctime can return NULL
diffstat:
crypto/external/bsd/openssh/dist/sshlogin.c | 8 ++++----
dist/ntp/libopts/save.c | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)
diffs (51 lines):
diff -r 86121a01b236 -r 134bd40afd2b crypto/external/bsd/openssh/dist/sshlogin.c
--- a/crypto/external/bsd/openssh/dist/sshlogin.c Sun Apr 04 00:08:49 2010 +0000
+++ b/crypto/external/bsd/openssh/dist/sshlogin.c Sun Apr 04 01:36:03 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sshlogin.c,v 1.2 2009/06/07 22:38:48 christos Exp $ */
+/* $NetBSD: sshlogin.c,v 1.3 2010/04/04 01:36:03 christos Exp $ */
/* $OpenBSD: sshlogin.c,v 1.26 2007/09/11 15:47:17 gilles Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
@@ -41,7 +41,7 @@
*/
#include "includes.h"
-__RCSID("$NetBSD: sshlogin.c,v 1.2 2009/06/07 22:38:48 christos Exp $");
+__RCSID("$NetBSD: sshlogin.c,v 1.3 2010/04/04 01:36:03 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -144,8 +144,8 @@
sizeof(hostname));
if (last_login_time != 0) {
- time_string = ctime(&last_login_time);
- time_string[strcspn(time_string, "\n")] = '\0';
+ if ((time_string = ctime(&last_login_time)) != NULL)
+ time_string[strcspn(time_string, "\n")] = '\0';
if (strcmp(hostname, "") == 0)
snprintf(buf, sizeof(buf), "Last login: %s\r\n",
time_string);
diff -r 86121a01b236 -r 134bd40afd2b dist/ntp/libopts/save.c
--- a/dist/ntp/libopts/save.c Sun Apr 04 00:08:49 2010 +0000
+++ b/dist/ntp/libopts/save.c Sun Apr 04 01:36:03 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.5 2008/08/23 09:10:31 kardel Exp $ */
+/* $NetBSD: save.c,v 1.6 2010/04/04 01:37:35 christos Exp $ */
/*
@@ -388,9 +388,10 @@
{
time_t timeVal = time( NULL );
- char* pzTime = ctime( &timeVal );
+ char* pzTime;
- fprintf( fp, zPresetFile, pzTime );
+ if ((pzTime = ctime( &timeVal )) != NULL)
+ fprintf( fp, zPresetFile, pzTime );
#ifdef HAVE_ALLOCATED_CTIME
/*
* The return values for ctime(), localtime(), and gmtime()
Home |
Main Index |
Thread Index |
Old Index