xbps-dgraph: only set rootdir it was set (fix #33).

This commit is contained in:
Juan RP 2014-03-10 10:20:04 +01:00
parent 2bb915c9d5
commit 878d2bf7e2
2 changed files with 7 additions and 2 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.33 (???): xbps-0.33 (???):
* xbps-dgraph: fixed a segfault if rootdir wasn't set:
issue #33: https://github.com/voidlinux/xbps/issues/33
* xbps-uhelper now supports downloading files with a defined destination. * xbps-uhelper now supports downloading files with a defined destination.
The syntax of fetch is "URI>FILENAME". So if you call The syntax of fetch is "URI>FILENAME". So if you call

View File

@ -1,5 +1,5 @@
/*- /*-
* Copyright (c) 2010-2013 Juan Romero Pardines. * Copyright (c) 2010-2014 Juan Romero Pardines.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -479,7 +479,9 @@ main(int argc, char **argv)
/* Initialize libxbps */ /* Initialize libxbps */
memset(&xh, 0, sizeof(xh)); memset(&xh, 0, sizeof(xh));
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir)); if (rootdir != NULL)
strncpy(xh.rootdir, rootdir, sizeof(xh.rootdir));
if ((rv = xbps_init(&xh)) != 0) if ((rv = xbps_init(&xh)) != 0)
die("failed to initialize libxbps: %s", strerror(rv)); die("failed to initialize libxbps: %s", strerror(rv));