rtp = rt ? pa_get_runtime_dir() : pa_get_state_dir();
if (fn) {
- char *r;
+ char *r, *canonical_rtp;
if (pa_is_path_absolute(fn)) {
pa_xfree(rtp);
if (!rtp)
return NULL;
+ /* Hopefully make the path smaller to avoid 108 char limit (fdo#44680) */
+ if ((canonical_rtp = pa_realpath(rtp))) {
+ if (strlen(rtp) >= strlen(canonical_rtp))
+ pa_xfree(rtp);
+ else {
+ pa_xfree(canonical_rtp);
+ canonical_rtp = rtp;
+ }
+ } else
+ canonical_rtp = rtp;
+
if (prependmid) {
char *mid;
if (!(mid = pa_machine_id())) {
- pa_xfree(rtp);
+ pa_xfree(canonical_rtp);
return NULL;
}
- r = pa_sprintf_malloc("%s" PA_PATH_SEP "%s-%s", rtp, mid, fn);
+ r = pa_sprintf_malloc("%s" PA_PATH_SEP "%s-%s", canonical_rtp, mid, fn);
pa_xfree(mid);
} else
- r = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", rtp, fn);
+ r = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", canonical_rtp, fn);
- pa_xfree(rtp);
+ pa_xfree(canonical_rtp);
return r;
} else
return rtp;