Date: Sat, 30 Jul 2016 04:40:44 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303538 - head/usr.bin/sed Message-ID: <201607300440.u6U4eihT040159@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sat Jul 30 04:40:44 2016 New Revision: 303538 URL: https://svnweb.freebsd.org/changeset/base/303538 Log: Explicitly test for cu_fgets returning NULL or !NULL MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/sed/compile.c Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Sat Jul 30 03:43:55 2016 (r303537) +++ head/usr.bin/sed/compile.c Sat Jul 30 04:40:44 2016 (r303538) @@ -546,7 +546,7 @@ compile_subst(const char *p, struct s_su if ((text = realloc(text, asize)) == NULL) err(1, "realloc"); } - } while ((p = cu_fgets(&more))); + } while ((p = cu_fgets(&more)) != NULL); errx(1, "%lu: %s: unterminated substitute in regular expression", linenum, fname); /* NOTREACHED */ @@ -733,7 +733,7 @@ compile_text(size_t *ptlen) if ((text = malloc(asize)) == NULL) err(1, "malloc"); size = 0; - while ((p = cu_fgets(NULL))) { + while ((p = cu_fgets(NULL)) != NULL) { op = s = text + size; for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n')
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607300440.u6U4eihT040159>