From patchwork Thu Nov 23 14:04:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17152 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 974D380618; Thu, 23 Nov 2017 15:05:07 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=openmesh-com.20150623.gappssmtp.com header.i=@openmesh-com.20150623.gappssmtp.com header.b="j36ZaUSd"; dkim-atps=neutral Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:400d:c09::241; helo=mail-qk0-x241.google.com; envelope-from=sven.eckelmann@openmesh.com; receiver= Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) by open-mesh.org (Postfix) with ESMTPS id C3622805ED for ; Thu, 23 Nov 2017 15:05:05 +0100 (CET) Received: by mail-qk0-x241.google.com with SMTP id c123so10701845qkf.7 for ; Thu, 23 Nov 2017 06:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yFx4RCb8xtR1eR4ZduVVHVPN3A2G14Hb9SEOhIASTKY=; b=j36ZaUSdoBtD4sSeKqYp3v1bZmD0AubpGnFm0npIrAqrDvJDnR6Jm3cZjCg9HZAupe eaPcndcG0iMM4WLVLNRdGeBE3q7qyyw3lsi7UXqpFrqOOKO1NaDUEqtXPnAU1sB9YPDB V+fcc3A0Ns3gMqlKh8X1lj6Nb06rXnLvNBWo6q21jqSIVz3lnJ9/7L63AXq1Ztnf62wx Hj2a0BmbTW9SnHEicktJpsR+Y7KCa5tbgyISGX7uj2fD8JsZ2Bpi5kZy7t6DYBvCjgie m3XtNRQQEdH3A9FuKjvvQDLOABDJu88QWIo5dgaIkT2ASDT0K8Hhy0VtsKF9zuBeysep Pggw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yFx4RCb8xtR1eR4ZduVVHVPN3A2G14Hb9SEOhIASTKY=; b=LSqCl+x1Pfyswn7w3lNrpjwnIkzNLYtDDAURKNen2xRj5qo6P7Icp+reZ4RmqGamN9 U2FLr734GaVVZtEPFT4OjAgzVMDsbJGQ4JdW4JPxNhCuJRU4y+ZJ1DGqOc8cEsyWpIbF 3/N9zMBXEEUctjqpBANAm5vEAEqqNtW9dzrC4e020dMbR1ff5/W9OjzCm7Bi788rOK12 Yobo8KRC2GtIFqZk7GQ7/efWUTQHvNqJeU/cf7rRxMKAgvEfeNf2ts73RvNw+v6qgOz6 qNUkIjPSKzonHzpgIak6nxRbdWmXWW3sWCT6jnYQ/lYjiud/iNTSIHmz0YmlY4PeJFsP 3KpA== X-Gm-Message-State: AJaThX7M4H7GOcOv9z37p6SF9PJanRXXDRip+rAfhAeKG7lvVzeqNZsZ DEJwV0+/qXXf0QGcBfb2IQzy6O0m X-Google-Smtp-Source: AGs4zMZozolvVA8gOb3JKk4pklaeHeZzcUuokPA87p+36c5+fYKg2tgNym5BF5madvNCgvCmgT27Rg== X-Received: by 10.55.18.92 with SMTP id c89mr37696789qkh.297.1511445904379; Thu, 23 Nov 2017 06:05:04 -0800 (PST) Received: from sven-desktop.home.narfation.org (p2003007C6F53F7FA6FAE965552C91071.dip0.t-ipconnect.de. [2003:7c:6f53:f7fa:6fae:9655:52c9:1071]) by smtp.gmail.com with ESMTPSA id g47sm13001075qtc.69.2017.11.23.06.05.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Nov 2017 06:05:03 -0800 (PST) From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 23 Nov 2017 15:04:35 +0100 Message-Id: <20171123140444.17119-2-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171123140444.17119-1-sven.eckelmann@openmesh.com> References: <20171123140444.17119-1-sven.eckelmann@openmesh.com> Subject: [B.A.T.M.A.N.] [PATCH 01/10] batctl: Print dummy value when localtime failed X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: Sven Eckelmann Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" localtime can return NULL when the local time could not be calculated. Accessing this NULL pointer is not allowed. Fixes: 05f27bfcd302 ("add arp packets , change output") Signed-off-by: Sven Eckelmann --- tcpdump.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcpdump.c b/tcpdump.c index 4ede76b..5eb99cf 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -104,7 +104,11 @@ static int print_time(void) gettimeofday(&tv, NULL); tm = localtime(&tv.tv_sec); - printf("%02d:%02d:%02d.%06ld ", tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec); + if (tm) + printf("%02d:%02d:%02d.%06ld ", tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec); + else + printf("00:00:00.000000 "); + return 1; }