From 07783b4f5b173dfc558ad9ee983a219d1d1d47e7 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 9 Jul 2018 12:05:12 +0000 Subject: No need to mention which memory allocation entry point failed (malloc, calloc or strdup), we just need to log that we ran out of memory in a particular function. Recommended by florian@ and deraadt@ ok benno@ henning@ tb@ --- usr.sbin/iscsictl/parse.y | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'usr.sbin/iscsictl') diff --git a/usr.sbin/iscsictl/parse.y b/usr.sbin/iscsictl/parse.y index fc9b294b366..7da81d57b4d 100644 --- a/usr.sbin/iscsictl/parse.y +++ b/usr.sbin/iscsictl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.13 2018/07/08 17:15:07 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.14 2018/07/09 12:05:11 krw Exp $ */ /* * Copyright (c) 2010 David Gwynne @@ -652,16 +652,16 @@ pushfile(const char *name, int secret) struct file *nfile; if ((nfile = calloc(1, sizeof(struct file))) == NULL) { - warn("calloc"); + warn("%s", __func__); return (NULL); } if ((nfile->name = strdup(name)) == NULL) { - warn("strdup"); + warn("%s", __func__); free(nfile); return (NULL); } if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { - warn("%s", nfile->name); + warn("%s: %s", __func__, nfile->name); free(nfile->name); free(nfile); return (NULL); @@ -670,7 +670,7 @@ pushfile(const char *name, int secret) nfile->ungetsize = 16; nfile->ungetbuf = malloc(nfile->ungetsize); if (nfile->ungetbuf == NULL) { - warn("malloc"); + warn("%s", __func__); fclose(nfile->stream); free(nfile->name); free(nfile); -- cgit v1.2.3