Date: Sun, 29 Jul 2007 05:35:22 GMT From: Andrew Turner <andrew@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 124296 for review Message-ID: <200707290535.l6T5ZMvp059148@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124296 Change 124296 by andrew@andrew_hermies on 2007/07/29 05:35:18 Start processing a install_patches call Add an assert to facund_has_update to check the value passed is valid Affected files ... .. //depot/projects/soc2007/andrew-update/backend/facund-be.c#18 edit Differences ... ==== //depot/projects/soc2007/andrew-update/backend/facund-be.c#18 (text+ko) ==== @@ -107,6 +107,7 @@ struct stat sb; char install_link[PATH_MAX], sha_base[PATH_MAX], sum[65]; + assert(pos < watched_db_count); snprintf(sha_base, PATH_MAX, "%s\n", watched_db[pos].db_base); SHA256_Data(sha_base, strlen(sha_base), sum); snprintf(install_link, PATH_MAX, "%s/%s-install", @@ -659,8 +660,24 @@ } static struct facund_response * -facund_call_install_patches(const char *id __unused, struct facund_object *obj __unused) +facund_call_install_patches(const char *id, struct facund_object *obj) { + const struct facund_object *cur; + unsigned int pos; + + if (obj == NULL) { + /* TODO: Don't use magic numbers */ + return facund_response_new(id, 1, "No data sent", NULL); + } + + if (facund_object_get_type(obj) != FACUND_ARRAY) { + return facund_response_new(id, 1, "Bad data sent", NULL); + } + + for (pos = 0; (cur = facund_object_get_array_item(obj, pos)) != NULL; + pos++) { + facund_object_print(__DECONST(struct facund_object *, cur)); + } printf("STUB: %s\n", __func__); return NULL; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707290535.l6T5ZMvp059148>