"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common.cpp" between
fish-3.5.0.tar.xz and fish-3.5.1.tar.xz

About: fish is a smart and user-friendly interactive command line shell.

common.cpp  (fish-3.5.0.tar.xz):common.cpp  (fish-3.5.1.tar.xz)
skipping to change at line 1903 skipping to change at line 1903
ssize_t len; ssize_t len;
len = readlink("/proc/self/exe", buff, sizeof buff - 1); // Linux len = readlink("/proc/self/exe", buff, sizeof buff - 1); // Linux
if (len == -1) { if (len == -1) {
len = readlink("/proc/curproc/file", buff, sizeof buff - 1); // other B SDs len = readlink("/proc/curproc/file", buff, sizeof buff - 1); // other B SDs
if (len == -1) { if (len == -1) {
len = readlink("/proc/self/path/a.out", buff, sizeof buff - 1); // Solaris len = readlink("/proc/self/path/a.out", buff, sizeof buff - 1); // Solaris
} }
} }
if (len > 0) { if (len > 0) {
buff[len] = '\0'; buff[len] = '\0';
return std::string(buff); // When /proc/self/exe points to a file that was deleted (or overwritten
on update!)
// then linux adds a " (deleted)" suffix.
// If that's not a valid path, let's remove that awkward suffix.
std::string buffstr{buff};
if (access(buff, F_OK)) {
auto dellen = const_strlen(" (deleted)");
if (buffstr.size() > dellen && buffstr.compare(buffstr.size() - dell
en, dellen, " (deleted)") == 0) {
buffstr = buffstr.substr(0, buffstr.size() - const_strlen(" (del
eted)"));
}
}
return buffstr;
} }
#endif #endif
// Just return argv0, which probably won't work (i.e. it's not an absolute p ath or a path // Just return argv0, which probably won't work (i.e. it's not an absolute p ath or a path
// relative to the working directory, but instead something the caller found via $PATH). We'll // relative to the working directory, but instead something the caller found via $PATH). We'll
// eventually fall back to the compile time paths. // eventually fall back to the compile time paths.
return std::string(argv0 ? argv0 : ""); return std::string(argv0 ? argv0 : "");
} }
/// Return a path to a directory where we can store temporary files. /// Return a path to a directory where we can store temporary files.
 End of changes. 1 change blocks. 
1 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)