2007/6/29, Andrew Fyfe <andrew@neptune-one.net>:
- newstr = strdup(depstring); + + newstr = calloc(strlen(depstring)+1, sizeof(char)); + strncpy(newstr, depstring, strlen(depstring));
hmm, that's basically the same, isn't it? :)
- - /* splitdep modifies the string... we'll compensate for now */ - char *saved_target = NULL; - saved_target = calloc(strlen(target)+1, sizeof(char)); - strncpy(saved_target, target, strlen(target)); - As for the rest of the patch, looking at the code I saw this and thought it looked a bit out of place, the problem is in alpm_splitdeps() and I didn't see anything else that depended on this behaviour of alpm_splitdeps(). So I changed alpm_splitdeps() not to modify the string
First off I should have attached a BIG warning, this is my first attempt at doing anything serious in C beyond basic examples :p The original reason for the patch was to change the exit code. At the moment pacman uses 1 for missing deps & errors. This can confuse makepkg if pacman returns an error instead of the list of missing packages and you end up with pacman saying something like Checking deps... Missing deps: error: There was an error Xavier wrote: passed to it. Andrew