* details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
strcpy(file, path);
- while ((link_len = readlink(file, link_path, MAXPATHLEN)) > 0)
+ while ((link_len = readlink(file, link_path, MAXPATHLEN - 1)) > 0)
{
- link_path[link_len-1] = 0;
+ link_path[link_len] = 0;
/* Force the link to be an absolute path, if necessary */
if (link_path[0] != '/')
{
int i;
- char number[10];
+ static char number[10];
/* Load sub-dialogs */
nameList[nameCount] = number;
for (i = 0; i < dialogCount; i++)
{
- sprintf(number, "%d", firstId);
+ snprintf(number, 10, "%d", firstId);
(*dialogArray)[i] = _DtGetResourceDialogData(dialogId, dataBase, nameList);
firstId++;
}
{
int i;
- char number[10];
+ static char number[10];
nameList[nameCount] = number;
nameList[nameCount + 1] = NULL;
for (i = 0; i < dialogCount; i++)
{
- sprintf(number, "%d", firstId);
+ snprintf(number, 10, "%d", firstId);
_DtWriteDialogData(dialogArray[i], fd, nameList);
firstId++;
}
/*
* This is a function for building a buffer name using predfined input
* and name template information from the types database.
- * WARNING: template_input will be freed. It must point to a char *.
+ * WARNING: template_input MAY be freed. It must point to a char *.
*/
static char *
}
else
{
+ DtDtsFreeAttributeValue(name_template);
return(template_input);
}
}
/* Resolve, if there're any, environment variables */
{
- FILE *pfp;
+ FILE *pfp = NULL;
char command[MAXPATHLEN];
memset(command, 0, sizeof(command));
sleep (1);
if (NULL != (fgets(command,MAXPATHLEN,pfp)))
break;
- }
+ }
if (i >= 5)
read_ok = 0;
}
XtFree(path);
path = XtNewString(command);
pclose(pfp);
+ pfp = NULL;
}
}
+ if (pfp)
+ {
+ pclose(pfp);
+ pfp = NULL;
+ }
}
/* Resolve '~' -- new memory is allocated, old memory is freed */