Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Akira TAGOH
3047622ccc Create a socket file under XDG_RUNTIME_DIR. (#924005) 2013-04-15 18:54:53 +09:00
Akira TAGOH
fcdfc124c4 Create a socket file under XDG_RUNTIME_DIR. (#924005) 2013-04-15 18:54:42 +09:00
2 changed files with 72 additions and 1 deletions

66
uim-runtimedir.patch Normal file
View file

@ -0,0 +1,66 @@
diff --git a/uim/uim-helper.c b/uim/uim-helper.c
index 7614d53..5d07ac2 100644
--- a/uim/uim-helper.c
+++ b/uim/uim-helper.c
@@ -165,6 +165,7 @@ uim_bool
uim_helper_get_pathname(char *helper_path, int len)
{
struct passwd *pw;
+ char *runtimedir;
if (len <= 0)
return UIM_FALSE;
@@ -172,27 +173,39 @@ uim_helper_get_pathname(char *helper_path, int len)
if (UIM_CATCH_ERROR_BEGIN())
return UIM_FALSE;
- pw = getpwuid(getuid());
- if (!pw) {
- endpwent();
- goto path_error;
- }
+ runtimedir = getenv("XDG_RUNTIME_DIR");
+ if (runtimedir && runtimedir[0]) {
+ if (strlcpy(helper_path, runtimedir, len) >= (size_t)len)
+ goto path_error;
+ if (strlcat(helper_path, "/uim", len) >= (size_t)len)
+ goto path_error;
+ } else {
+ pw = getpwuid(getuid());
+ if (!pw) {
+ endpwent();
+ goto path_error;
+ }
- if (strlcpy(helper_path, pw->pw_dir, len) >= (size_t)len) {
- endpwent();
- goto path_error;
- }
- if (strlcat(helper_path, "/.uim.d", len) >= (size_t)len) {
+ if (strlcpy(helper_path, pw->pw_dir, len) >= (size_t)len) {
+ endpwent();
+ goto path_error;
+ }
+ if (strlcat(helper_path, "/.uim.d", len) >= (size_t)len) {
+ endpwent();
+ goto path_error;
+ }
endpwent();
- goto path_error;
}
- endpwent();
- /* check ~/.uim.d/ */
+ /* check $XDG_RUNTIME_DIR/uim/ if $XDG_RUNTIME_DIR is available.
+ * otherwise ~/.uim.d/
+ */
if (!check_dir(helper_path))
goto path_error;
- /* check ~/.uim.d/socket/ */
+ /* check $XDG_RUNTIME_DIR/uim/socket/ if $XDG_RUNTIME_DIR is available.
+ * otherwise ~/.uim.d/socket/
+ */
if (strlcat(helper_path, "/socket", len) >= (size_t)len)
goto path_error;

View file

@ -3,7 +3,7 @@
Name: uim
Version: 1.8.5
Release: 1%{?dist}
Release: 2%{?dist}
# uim itself is licensed under BSD
# scm/py.scm, helper/eggtrayicon.[ch], qt/pref-kseparator.{cpp,h}
# and qt/chardict/chardict-kseparator.{cpp,h} is licensed under LGPLv2+
@ -25,6 +25,7 @@ Source1: xinput.d-uim
Source2: uim-init.el
Patch1: uim-emacs-utf8.patch
Patch2: uim-enable-libgcroots.patch
Patch3: %{name}-runtimedir.patch
Summary: A multilingual input method library
@ -235,6 +236,7 @@ many languages using the input table map from m17n-db.
%setup -q
%patch1 -p1 -b .1-emacs
%patch2 -p1 -b .2-libgcroots
%patch3 -p1 -b .3-runtimedir
autoconf
@ -567,6 +569,9 @@ fi
%dir %{_datadir}/uim
%changelog
* Mon Apr 15 2013 Akira TAGOH <tagoh@redhat.com> - 1.8.5-2
- Create a socket file under XDG_RUNTIME_DIR. (#924005)
* Mon Apr 1 2013 Akira TAGOH <tagoh@redhat.com> - 1.8.5-1
- New upstream release. (#946901)