vector with newly allocated memory! Also, don't try to get a new
machine id unless this is an add_host query.
Removed declaration for malloc, to support optional debugging malloc.
EXEC SQL BEGIN DECLARE SECTION;
int ngid;
EXEC SQL END DECLARE SECTION;
EXEC SQL BEGIN DECLARE SECTION;
int ngid;
EXEC SQL END DECLARE SECTION;
unsigned char *p;
int idx;
unsigned char *p;
int idx;
value = htonl(value);
}
value = htonl(value);
value = htonl(value);
}
value = htonl(value);
- argv[9+row] = strsave(inet_ntoa(value));
+ strcpy(argv[9+row], inet_ntoa(value));
- argv[9+row] = strsave("unassigned");
+ strcpy(argv[9+row], "unassigned");
+ /*
+ * If this is an update_host query, we're done.
+ */
+ if (row == 1)
+ return(MR_SUCCESS);
+
+ /*
+ * For an add_host query, allocate and fill in a new machine id,
+ * and then insert the creator id.
+ */
if ((mr_errcode = prefetch_value(q,argv,cl)) != MR_SUCCESS)
return(mr_errcode);
if ((mr_errcode = prefetch_value(q,argv,cl)) != MR_SUCCESS)
return(mr_errcode);
- row = q->argc + q->vcnt + 1;
- sprintf(buf, "%d",cl->client_id);
- argv[row] = strsave(buf);
- argv[row+1] = NULL;
+ sprintf(argv[q->argc + q->vcnt + 1], "%d",cl->client_id);