On 04/11/2014 01:11 PM, John Ferlan wrote: >> +++ b/src/util/virfile.h >> @@ -144,6 +144,9 @@ int virFileStripSuffix(char *str, >> >> int virFileLinkPointsTo(const char *checkLink, >> const char *checkDest); >> +int virFileRelLinkPointsTo(const char *directory, >> + const char *checkLink, >> + const char *checkDest); > > Should there be a ATTRIBUTE_NONNULL(1,2,3) here?? Probably same for > PointsTo argument 1... Just copying existing style, but you are correct that it makes sense for 2 and 3. For 1, NULL is permitted if checkLink is absolute. > ACK in general though Squashing this and pushing: diff --git i/src/util/virfile.c w/src/util/virfile.c index 10c4337..3eb2703 100644 --- i/src/util/virfile.c +++ w/src/util/virfile.c @@ -1398,6 +1398,12 @@ virFileRelLinkPointsTo(const char *directory, if (*checkLink == '/') return virFileLinkPointsTo(checkLink, checkDest); + if (!directory) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot resolve '%s' without starting directory"), + checkLink); + return -1; + } if (virAsprintf(&candidate, "%s/%s", directory, checkLink) < 0) return -1; ret = virFileLinkPointsTo(candidate, checkDest); diff --git i/src/util/virfile.h w/src/util/virfile.h index 168eb0d..46ef781 100644 --- i/src/util/virfile.h +++ w/src/util/virfile.h @@ -143,10 +143,12 @@ int virFileStripSuffix(char *str, const char *suffix) ATTRIBUTE_RETURN_CHECK; int virFileLinkPointsTo(const char *checkLink, - const char *checkDest); + const char *checkDest) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virFileRelLinkPointsTo(const char *directory, const char *checkLink, - const char *checkDest); + const char *checkDest) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virFileResolveLink(const char *linkpath, char **resultpath) ATTRIBUTE_RETURN_CHECK; -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list