Revision: 42143
http://brlcad.svn.sourceforge.net/brlcad/?rev=42143&view=rev
Author: brlcad
Date: 2011-01-12 15:45:59 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
add code to make sure, even though it's a very unlikely event, that we never
return an empty string.
Modified Paths:
--------------
brlcad/trunk/src/libbu/whereis.c
brlcad/trunk/src/libbu/which.c
Modified: brlcad/trunk/src/libbu/whereis.c
===================================================================
--- brlcad/trunk/src/libbu/whereis.c 2011-01-12 15:17:43 UTC (rev 42142)
+++ brlcad/trunk/src/libbu/whereis.c 2011-01-12 15:45:59 UTC (rev 42143)
@@ -76,6 +76,8 @@
return NULL;
}
if (bu_file_exists(bu_whereis_result) && strchr(bu_whereis_result,
BU_DIR_SEPARATOR)) {
+ if (bu_whereis_result[0] == '\0')
+ return NULL; /* never return empty */
return bu_whereis_result;
}
@@ -114,6 +116,8 @@
snprintf(bu_whereis_result, MAXPATHLEN, "%s/%s", directory, cmd);
if (bu_file_exists(bu_whereis_result)) {
+ if (bu_whereis_result[0] == '\0')
+ return NULL; /* never return empty */
return bu_whereis_result;
}
Modified: brlcad/trunk/src/libbu/which.c
===================================================================
--- brlcad/trunk/src/libbu/which.c 2011-01-12 15:17:43 UTC (rev 42142)
+++ brlcad/trunk/src/libbu/which.c 2011-01-12 15:45:59 UTC (rev 42143)
@@ -68,6 +68,8 @@
}
if (bu_file_exists(bu_which_result) && strchr(bu_which_result,
BU_DIR_SEPARATOR)) {
+ if (bu_which_result[0] == '\0')
+ return NULL; /* never return empty */
return bu_which_result;
}
@@ -115,6 +117,8 @@
snprintf(bu_which_result, MAXPATHLEN, "%s/%s", directory, cmd);
if (bu_file_exists(bu_which_result)) {
+ if (bu_which_result[0] == '\0')
+ return NULL; /* never return empty */
return bu_which_result;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits