PERFORCE change 124296 for review
Andrew Turner
andrew at FreeBSD.org
Sun Jul 29 05:35:23 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=124296
Change 124296 by andrew at 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;
}
More information about the p4-projects
mailing list