char *atoken = 0;
const char *search_token;
const char *tokend;
- PATH_VAR(sh_path);
extern const char *default_shell;
if (!token)
{
batch_mode_shell = 1;
unixy_shell = 0;
- sprintf (sh_path, "%s", search_token);
- default_shell = xstrdup (w32ify (sh_path, 0));
+ default_shell = xstrdup (w32ify (search_token, 0));
DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
default_shell));
sh_found = 1;
else if (_access (search_token, 0) == 0)
{
/* search token path was found */
- sprintf (sh_path, "%s", search_token);
- default_shell = xstrdup (w32ify (sh_path, 0));
+ default_shell = xstrdup (w32ify (search_token, 0));
DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
default_shell));
sh_found = 1;
while (ep && *ep)
{
+ PATH_VAR (sh_path);
+
*ep = '\0';
- sprintf (sh_path, "%s/%s", p, search_token);
+ snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token);
if (_access (sh_path, 0) == 0)
{
default_shell = xstrdup (w32ify (sh_path, 0));
/* be sure to check last element of Path */
if (p && *p)
{
- sprintf (sh_path, "%s/%s", p, search_token);
+ PATH_VAR (sh_path);
+ snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token);
if (_access (sh_path, 0) == 0)
{
default_shell = xstrdup (w32ify (sh_path, 0));
char *p;
if (resolve)
- _fullpath(w32_path, filename, sizeof (w32_path));
+ {
+ char *fp = _fullpath (NULL, filename, sizeof (w32_path));
+ strncpy (w32_path, fp, sizeof (w32_path));
+ free (fp);
+ }
else
- strncpy(w32_path, filename, sizeof (w32_path));
+ strncpy(w32_path, filename, sizeof (w32_path));
for (p = w32_path; p && *p; p++)
- if (*p == '\\')
- *p = '/';
+ if (*p == '\\')
+ *p = '/';
return w32_path;
}