- if (command)
- execl(shell, shname, "-c", command, NULL);
- else
- execl(shell, shname, "-i", NULL);
+ if (access(shell, X_OK) == 0) {
+ if (command)
+ execl(shell, shname, "-c", command, NULL);
+ else
+ execl(shell, shname, "-i", NULL);
+ } else {
+ if (command)
+ execlp(shname, "-c", command, NULL);
+ else
+ execlp(shname, "-i", NULL);
+ }