Date: Sun, 15 Jul 2007 22:18:07 GMT From: Garrett Cooper <gcooper@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 123553 for review Message-ID: <200707152218.l6FMI7Yq063468@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=123553 Change 123553 by gcooper@optimus-revised_pkgtools on 2007/07/15 22:17:41 Important base case I didn't think of before. If the length of the string returned was null, no dice, exit add_plist immediately. This fixes pkg_version. Affected files ... .. //depot/projects/soc2007/revised_fbsd_pkgtools/usr/src/usr.sbin/pkg_install/lib/plist.c#10 edit Differences ... ==== //depot/projects/soc2007/revised_fbsd_pkgtools/usr/src/usr.sbin/pkg_install/lib/plist.c#10 (text+ko) ==== @@ -357,19 +357,18 @@ return PLIST_CONFLICTS; /** FALL-THROUGH **/ - case 'e': /** EXEC **/ if (!strcmp(cmd, "exec")) return PLIST_CMD; + /** FALL-THROUGH **/ - case 'u': /** UN(DO)EXEC **/ if (!strcmp(cmd, "unexec")) return PLIST_UNEXEC; + /** FALL-THROUGH **/ - case 'i': /** IGNORE **/ if (!strcmp(cmd, "ignore")) @@ -377,8 +376,8 @@ /** IGNORE_INST **/ else if(!strcmp(cmd, "ignore_inst")) return PLIST_IGNORE_INST; + /** FALL-THROUGH **/ - case 'd': /** DIRRM **/ if (!strcmp(cmd, "dirrm")) @@ -386,8 +385,8 @@ /** DISPLAY **/ else if(!strcmp(cmd, "display")) return PLIST_DISPLAY; + /** FALL-THROUGH **/ - case 'n': /** NAME **/ if(!strcmp(cmd, "name")) @@ -395,8 +394,8 @@ /** NOINST **/ else if (!strcmp(cmd, "noinst")) return PLIST_NOINST; + /** FALL-THROUGH **/ - case 'm': /** MODE **/ if(!strcmp(cmd, "mode")) @@ -404,8 +403,8 @@ /** MTREE **/ else if(!strcmp(cmd, "mtree")) return PLIST_MTREE; + /** FALL-THROUGH **/ - case 'o': /** OWNER **/ if(!strcmp(cmd, "owner")) @@ -413,28 +412,28 @@ /** OPTION **/ else if (!strcmp(cmd, "option")) return PLIST_OPTION; + /** FALL-THROUGH **/ - case 's': /** SRCDIR **/ if(!strcmp(cmd, "srcdir")) return PLIST_SRC; + /** FALL-THROUGH **/ - case 'g': /** GROUP **/ if (!strcmp(cmd, "group")) return PLIST_CHGRP; + /** FALL-THROUGH **/ - case 'p': /** PKGDEP **/ if (!strcmp(cmd, "pkgdep")) return PLIST_PKGDEP; + /** FALL-THROUGH **/ - /** Apparently the command didn't match .. oops **/ - default: + default: /** Apparently the command didn't match anything above .. oops **/ return FAIL; } @@ -461,10 +460,15 @@ pkg->fmtver_mnr = 2; pkg->origin = NULL; - plines = fileGetContentsByDescriptor(fp, "+CONTENTS"); + plines = fileGetContentsByDescriptor(fp, CONTENTS_FNAME); + + if(0 == strlen(plines)) + return; pline = strtok(plines, "\n"); + assert(pline != NULL); + if(0 == trim_end_whitespace(pline)) errx(-1, "Length of first line was 0. This shouldn't happen");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707152218.l6FMI7Yq063468>