]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge topic branch t/home into pu
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 16 May 2024 23:45:31 +0000 (01:45 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 16 May 2024 23:45:31 +0000 (01:45 +0200)
Started on 2024-03-20

* refs/heads/t/home:
  f
  f
  Replace get_homedir() by get_confdir().
  Consult $HOME rather than calling getpwuid(),

1  2 
play.c

diff --combined play.c
index b28cce63140b4e082249f574e244e4662dc86d3c,cc87286518469c53e8c2c3d006a842e3772e12f4..e2ee5fe3a75578a582a8ecd08baa207b1ad8131d
--- 1/play.c
--- 2/play.c
+++ b/play.c
@@@ -948,7 -948,7 +948,7 @@@ static int com_ff(struct lls_parse_resu
        seconds += (get_play_time() + 500) / 1000;
        seconds = PARA_MIN(seconds, (typeof(seconds))pt->seconds - 4);
        seconds = PARA_MAX(seconds, 0);
 -      pt->start_chunk = pt->num_chunks * seconds / pt->seconds;
 +      pt->start_chunk = (uint64_t)pt->num_chunks * seconds / pt->seconds;
        pt->start_chunk = PARA_MIN(pt->start_chunk, pt->num_chunks - 1);
        pt->start_chunk = PARA_MAX(pt->start_chunk, 0UL);
        if (!pt->playing)
@@@ -1044,17 -1044,14 +1044,14 @@@ static void session_open(void
        if (OPT_GIVEN(HISTORY_FILE))
                history_file = para_strdup(OPT_STRING_VAL(HISTORY_FILE));
        else {
-               char *home = para_homedir();
-               char *dot_para = make_message("%s/.paraslash", home);
+               const char *confdir = get_confdir();
  
-               free(home);
-               ret = para_mkdir(dot_para);
+               ret = para_mkdir(confdir);
                /* warn, but otherwise ignore mkdir error */
                if (ret < 0)
-                       PARA_WARNING_LOG("Can not create %s: %s\n", dot_para,
+                       PARA_WARNING_LOG("Can not create %s: %s\n", confdir,
                                para_strerror(-ret));
-               history_file = make_message("%s/play.history", dot_para);
-               free(dot_para);
+               history_file = make_message("%s/play.history", confdir);
        }
        ici.history_file = history_file;
        ici.loglevel = loglevel;