summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 12:53:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-23 09:02:58 +0200
commita8622c77d26ca7a635afc95bba9a5054dc31eb7c (patch)
treeecb1ce71272291515dec10fc5fe94061f7231b78 /shell
parent2684aefcf5d2804351bda01a2d2fe7bbbd351451 (diff)
loplugin:flatten in sdext..stoc
Change-Id: I460e813e20a691c53738373376d3363f553bbab2 Reviewed-on: https://gerrit.libreoffice.org/42636 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'shell')
-rw-r--r--shell/source/unix/sysshell/recently_used_file.cxx52
1 files changed, 25 insertions, 27 deletions
diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx
index ee0e598fbd32..9068e96b0b55 100644
--- a/shell/source/unix/sysshell/recently_used_file.cxx
+++ b/shell/source/unix/sysshell/recently_used_file.cxx
@@ -50,37 +50,35 @@ recently_used_file::recently_used_file() :
osl::Security sec;
OUString homedir_url;
- if (sec.getHomeDir(homedir_url))
- {
- OUString homedir;
- osl::FileBase::getSystemPathFromFileURL(homedir_url, homedir);
-
- OUString rufn = homedir;
- ensure_final_slash(rufn);
- rufn += ".recently-used";
-
- OString tmp =
- OUStringToOString(rufn, osl_getThreadTextEncoding());
-
- int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
- if (fd != -1) {
- file_ = fdopen(fd, "w+");
- if (file_ == nullptr) {
- close(fd);
- }
- }
+ if (!sec.getHomeDir(homedir_url))
+ throw "Cannot determine user home directory";
+
+ OUString homedir;
+ osl::FileBase::getSystemPathFromFileURL(homedir_url, homedir);
+
+ OUString rufn = homedir;
+ ensure_final_slash(rufn);
+ rufn += ".recently-used";
- if (nullptr == file_)
- throw "I/O error opening ~/.recently-used";
+ OString tmp =
+ OUStringToOString(rufn, osl_getThreadTextEncoding());
- if (lockf(fileno(file_), F_LOCK, 0) != 0)
- {
- fclose(file_);
- throw "Cannot lock ~/.recently-used";
+ int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd != -1) {
+ file_ = fdopen(fd, "w+");
+ if (file_ == nullptr) {
+ close(fd);
}
}
- else
- throw "Cannot determine user home directory";
+
+ if (nullptr == file_)
+ throw "I/O error opening ~/.recently-used";
+
+ if (lockf(fileno(file_), F_LOCK, 0) != 0)
+ {
+ fclose(file_);
+ throw "Cannot lock ~/.recently-used";
+ }
}