Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package linuxrc for openSUSE:Factory checked 
in at 2021-01-26 14:44:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/linuxrc (Old)
 and      /work/SRC/openSUSE:Factory/.linuxrc.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "linuxrc"

Tue Jan 26 14:44:00 2021 rev:292 rq:865422 version:7.0.26

Changes:
--------
--- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes  2021-01-20 
18:23:35.215315919 +0100
+++ /work/SRC/openSUSE:Factory/.linuxrc.new.28504/linuxrc.changes       
2021-01-26 14:44:01.691188212 +0100
@@ -1,0 +2,15 @@
+Thu Jan 21 13:52:52 UTC 2021 - [email protected]
+
+- merge gh#openSUSE/linuxrc#245
+- Fix the wrong function name
+- Replace splash with plymouth utils (boo#1149070)
+- 7.0.26
+
+--------------------------------------------------------------------
+Thu Jan 21 13:49:14 UTC 2021 - [email protected]
+
+- merge gh#openSUSE/linuxrc#244
+- cleanup module code to avoid static string buffers (bsc#1180792)
+- minor adjustments
+
+--------------------------------------------------------------------

Old:
----
  linuxrc-7.0.25.tar.xz

New:
----
  linuxrc-7.0.26.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ linuxrc.spec ++++++
--- /var/tmp/diff_new_pack.y53xE1/_old  2021-01-26 14:44:02.363189252 +0100
+++ /var/tmp/diff_new_pack.y53xE1/_new  2021-01-26 14:44:02.363189252 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           linuxrc
-Version:        7.0.25
+Version:        7.0.26
 Release:        0
 Summary:        SUSE Installation Program
 License:        GPL-3.0+

++++++ linuxrc-7.0.25.tar.xz -> linuxrc-7.0.26.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/VERSION new/linuxrc-7.0.26/VERSION
--- old/linuxrc-7.0.25/VERSION  2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/VERSION  2021-01-21 14:52:52.000000000 +0100
@@ -1 +1 @@
-7.0.25
+7.0.26
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/auto2.c new/linuxrc-7.0.26/auto2.c
--- old/linuxrc-7.0.25/auto2.c  2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/auto2.c  2021-01-21 14:52:52.000000000 +0100
@@ -39,7 +39,6 @@
 static void auto2_read_repo_file(url_t *url, char *src, char *dst);
 static void auto2_read_repo_files(url_t *url);
 static void auto2_read_repomd_files(url_t *url);
-static char *auto2_splash_name(void);
 
 static int test_and_add_dud(url_t *url);
 static void auto2_read_autoyast(url_t *url);
@@ -73,7 +72,7 @@
 
   if(config.sig_failed) return 0;
 
-  util_splash_bar(40, SPLASH_40);
+  util_splash_bar(40);
 
   win_old = config.win;
 
@@ -123,7 +122,7 @@
 
   LXRC_WAIT
 
-  util_splash_bar(50, SPLASH_50);
+  util_splash_bar(50);
 
   return ok;
 }
@@ -156,6 +155,7 @@
 #endif
 
   log_info("Starting hardware detection...\n");
+  util_splash_msg("Hardware detection");
   printf("Starting hardware detection...");
   if(hd_data->progress) printf("\n");
   fflush(stdout);
@@ -171,7 +171,7 @@
   fflush(stdout);
   log_info("Hardware detection finished.\n");
 
-  util_splash_bar(20, SPLASH_20);
+  util_splash_bar(20);
 
   log_show("(If a driver is not working for you, try booting with 
brokenmodules=driver_name.)\n\n");
 
@@ -266,7 +266,7 @@
     log_show(" ok\n");
   }
 
-  util_splash_bar(30, SPLASH_30);
+  util_splash_bar(30);
 
   /* look for keyboard and remember if it's usb */
   for(ju = 0, hd = hd_data->hd; hd; hd = hd->next) {
@@ -944,45 +944,13 @@
 
 
 /*
- * Return splash file name (or NULL if not appropriate).
- */
-char *auto2_splash_name()
-{
-  unsigned width, height;
-  char *splash = NULL, *s;
-  FILE *f;
-
-  if(!config.kexec_initrd) return NULL;
-
-  f = fopen("/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size", "r");
-  if(f) {
-    if(fscanf(f, "%u,%u", &width, &height) == 2) {
-      str_copy(&splash, config.kexec_initrd);
-      s = strrchr(splash, '/');
-      if(s) {
-        *s = 0;
-        strprintf(&splash, "%s/%04u%04u.spl", splash, width, height);
-      }
-      else {
-        str_copy(&splash, NULL);
-      }
-    }
-
-    fclose(f);
-  }
-
-  return splash;
-}
-
-
-/*
  * Download new kernel & initrd and run kexec.
  *
  * Does not return if successful.
  */
 void auto2_kexec(url_t *url)
 {
-  char *kernel, *initrd, *buf = NULL, *cmdline = NULL, *splash = NULL, 
*splash_name = NULL;
+  char *kernel, *initrd, *buf = NULL, *cmdline = NULL;
   FILE *f;
   int err = 0;
   unsigned vga_mode = 0;
@@ -992,9 +960,6 @@
     return;
   }
 
-  splash_name = auto2_splash_name();
-  log_debug("splash = %s\n", splash_name);
-
 #if defined(__i386__) || defined(__x86_64__)
   if(config.vga) {
     vga_mode = config.vga_mode;
@@ -1004,22 +969,10 @@
 
   kernel = strdup(new_download());
   initrd = strdup(new_download());
-  splash = strdup(new_download());
 
   err = url_read_file(url, NULL, config.kexec_kernel, kernel, NULL, 
URL_FLAG_PROGRESS);
   if(!err) err = url_read_file(url, NULL, config.kexec_initrd, initrd, NULL, 
URL_FLAG_PROGRESS);
 
-  if(!err && splash_name) {
-    err = url_read_file(url, NULL, splash_name, splash, NULL, 
URL_FLAG_PROGRESS);
-    if(!err) {
-      strprintf(&buf, "cat %s >>%s", splash, initrd);
-      lxrc_run_console(buf);
-    }
-    else {
-      err = 0;
-    }
-  }
-
   if(!err) {
     cmdline = calloc(1024, 1);
     if((f = fopen("/proc/cmdline", "r"))) {
@@ -1042,8 +995,6 @@
 
   free(kernel);
   free(initrd);
-  free(splash);
-  free(splash_name);
   free(buf);
   free(cmdline);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/changelog new/linuxrc-7.0.26/changelog
--- old/linuxrc-7.0.25/changelog        2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/changelog        2021-01-21 14:52:52.000000000 +0100
@@ -1,3 +1,11 @@
+2021-01-21:    7.0.26
+       - merge gh#openSUSE/linuxrc#244
+       - cleanup module code to avoid static string buffers (bsc#1180792)
+       - minor adjustments
+       - merge gh#openSUSE/linuxrc#245
+       - Replace splash with plymouth utils
+       - Fix the wrong function name
+
 2021-01-19:    7.0.25
        - merge gh#openSUSE/linuxrc#241
        - fix writing out of menu item array bounds (bsc#1180792)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/global.h new/linuxrc-7.0.26/global.h
--- old/linuxrc-7.0.25/global.h 2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/global.h 2021-01-21 14:52:52.000000000 +0100
@@ -370,12 +370,10 @@
 #define NS_DEFAULT             (NS_DHCP | NS_HOSTIP | NS_GATEWAY | 
NS_NAMESERVER)
 #endif
 
-#define SPLASH_10      NULL
-#define SPLASH_20      "rlchange B"
-#define SPLASH_30      NULL
-#define SPLASH_40      NULL
-#define SPLASH_50      "rlchange 3"
-#define SPLASH_60      "splash_early start"
+#define PLY_MODE_UPDATE                "updates"
+#define PLY_MODE_UPGRADE       "system-upgrade"
+#define PLY_MODE_REBOOT                "reboot"
+#define PLY_MODE_SHUTDOWN      "shutdown"
 
 typedef struct {
   unsigned rebootmsg:1;                /**< show reboot message */
@@ -404,7 +402,6 @@
   unsigned sshd_only:1;                /**< start only sshd */
   unsigned addswap:2;          /**< offer to add swap if yast needs it */
   unsigned aborted:1;          /**< yast did abort the installation */
-  unsigned splash:1;           /**< splash active */
   unsigned netstop:2;          /**< shut down network interface at end 0: no, 
1: yes, 3: auto */
   unsigned noshell:1;          /**< don't start any shells */
   volatile unsigned restart_on_segv:1; /**< restart linuxrc after segfault */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/install.c new/linuxrc-7.0.26/install.c
--- old/linuxrc-7.0.25/install.c        2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/install.c        2021-01-21 14:52:52.000000000 +0100
@@ -1110,7 +1110,7 @@
 
   LXRC_WAIT
 
-  util_splash_bar(60, SPLASH_60);
+  util_splash_bar(60);
 
   if(config.manual) {
     util_umount_all();
@@ -1364,8 +1364,6 @@
   disp_set_color(COL_WHITE, COL_BLACK);
   if(config.win) util_disp_done();
 
-  if(config.splash && config.textmode) lxrc_run_console("echo 0 
>/proc/splash");
-
   str_copy(&setupcmd, config.setupcmd);
 
   if(config.url.install->scheme == inst_exec) {
@@ -1449,8 +1447,6 @@
 
   str_copy(&setupcmd, NULL);
 
-  if(config.splash && config.textmode) lxrc_run_console("echo 1 
>/proc/splash");
-
   log_info("install program exit code is %d\n", err);
 
   /* Redraw erverything and go back to the main menu. */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/linuxrc.c new/linuxrc-7.0.26/linuxrc.c
--- old/linuxrc-7.0.25/linuxrc.c        2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/linuxrc.c        2021-01-21 14:52:52.000000000 +0100
@@ -266,6 +266,8 @@
 
 void lxrc_reboot()
 {
+  util_splash_mode(PLY_MODE_REBOOT);
+
   if(config.test) {
     log_info("*** reboot ***\n");
     return;
@@ -278,6 +280,8 @@
 
 void lxrc_halt()
 {
+  util_splash_mode(PLY_MODE_SHUTDOWN);
+
   if(config.test) {
     log_info("*** power off ***\n");
     return;
@@ -1036,9 +1040,9 @@
 
   if(config.plymouth) util_run_script("plymouth_setup");
 
-  util_get_splash_status();
+  util_splash_mode(PLY_MODE_UPGRADE);
 
-  util_splash_bar(10, SPLASH_10);
+  util_splash_bar(10);
 
   set_activate_language(config.language);
 
@@ -1053,6 +1057,7 @@
   LXRC_WAIT
 
   log_show("Loading basic drivers...");
+  util_splash_msg("Loading basic drivers");
   mod_init(1);
   log_show(" ok\n");
 
@@ -1629,18 +1634,23 @@
     { "zstd_decompress" },
     { }
   };
-  char file[MAX_FILENAME], insmod[MAX_FILENAME + 200];
 
-  for (i = basics; i->name; i++) {
-    if(!mod_find_module("/modules", i->name, file)) {
-      if(i->mandatory)
+  for(i = basics; i->name; i++) {
+    char *buf = mod_find_module("/modules", i->name);
+
+    if(!buf) {
+      if(i->mandatory) {
        log_show("Cannot find module %s!\n", i->name);
+      }
       continue;
     }
 
-    sprintf(insmod, "/sbin/insmod %s%s%s", file, i->param ? " " : "",
-       i->param ? : "");
-    lxrc_run(insmod);
+    strprintf(&buf, "/sbin/insmod %s", buf);
+    if(i->param) strprintf(&buf, "%s %s", buf, i->param);
+
+    lxrc_run(buf);
+
+    free(buf);
   }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/module.c new/linuxrc-7.0.26/module.c
--- old/linuxrc-7.0.25/module.c 2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/module.c 2021-01-21 14:52:52.000000000 +0100
@@ -1,10 +1,9 @@
-#define _GNU_SOURCE
-
 /*
  *
  * module.c      Load modules needed for installation
  *
  * Copyright (c) 1996-2002  Hubert Mantel, SuSE Linux AG  ([email protected])
+ * Copyright (c) 2002-2021  SUSE LLC
  *
  */
 
@@ -41,18 +40,17 @@
 #define MODULE_CONFIG          "module.config"
 #define CARDMGR_PIDFILE                "/run/cardmgr.pid"
 
-#define MODULE_SUFFIX  ".ko"
-#define MODULE_COMP1   ".xz"
 #define MOD_EXT(mod)   { .ext = (mod), .len = sizeof(mod) - 1 }
 
 typedef struct {
-       char *ext;
-       size_t len;
+  char *ext;
+  size_t len;
 } mod_extensions_t;
 
+// list of recognized module file name extensions
 static const mod_extensions_t mod_extensions[] = {
-  MOD_EXT(MODULE_SUFFIX MODULE_COMP1),
-  MOD_EXT(MODULE_SUFFIX),
+  MOD_EXT(".ko.xz"),
+  MOD_EXT(".ko"),
   { }
 };
 
@@ -119,98 +117,61 @@
   return len >= ext_len && !strcmp(file + len - ext_len, ext);
 }
 
-int mod_has_module_ext(const char *file, const size_t len, size_t *ext_pos)
+/*
+ * Return length of module file name without module extension if it is a
+ * module file name. Otherwise 0.
+ */
+int mod_basename_len(const char *file)
 {
   const mod_extensions_t *mod_ext;
+  size_t len = strlen(file);
 
-  for (mod_ext = mod_extensions; mod_ext->ext; mod_ext++)
-    if (mod_cmp_ext(file, len, mod_ext->ext, mod_ext->len)) {
-      if (ext_pos)
-       *ext_pos = len - mod_ext->len;
-      return 1;
+  for(mod_ext = mod_extensions; mod_ext->ext; mod_ext++) {
+    if(mod_cmp_ext(file, len, mod_ext->ext, mod_ext->len)) {
+      return len - mod_ext->len;
     }
+  }
 
   return 0;
 }
 
-int mod_find_module(const char *prefix, const char *module, char *file)
+
+/*
+ * Return file name with module extension removed if it is a module; else
+ * return a copy of the file name.
+ *
+ * The returned storage must be released using free().
+ */
+char *mod_basename(const char *file)
 {
-  const mod_extensions_t *mod_ext;
-  int file_len;
+  char *buf = strdup(file);
+  int base_len = mod_basename_len(file);
 
-  file_len = sprintf(file, "%s/%s", prefix, module);
-  for (mod_ext = mod_extensions; mod_ext->ext; mod_ext++) {
-    strcpy(file + file_len, mod_ext->ext);
-    if(util_check_exist(file))
-      return 1;
-  }
+  if(buf && base_len) buf[base_len] = 0;
 
-  return 0;
+  return buf;
 }
 
-int mod_copy_modules(char *src_dir, int doit)
-{
-  struct dirent *de;
-  DIR *d;
-  char buf[512];
-  int i, i1, i2, cnt = 0, ok;
-  window_t win;
-  static int files = 0;
-  struct stat sbuf1, sbuf2;
 
-  if(doit == 2 && !files) return 0;
-  if(!(d = opendir(src_dir))) return 0;
+/*
+ * Return full module file name (including dir and file extension) or NULL
+ * if module was not found.
+ *
+ * Returned storage must be released using free().
+ */
+char *mod_find_module(const char *prefix, const char *module)
+{
+  char *file = NULL;
+  const mod_extensions_t *mod_ext;
 
-  if(doit == 2) {
-    dia_status_on(&win, "Copying modules...");
-  }
-  else {
-    files = 0;
+  for(mod_ext = mod_extensions; mod_ext->ext; mod_ext++) {
+    strprintf(&file, "%s/%s%s", prefix, module, mod_ext->ext);
+    if(util_check_exist(file)) return file;
   }
 
-  while((de = readdir(d))) {
-    i = strlen(de->d_name);
-    if(mod_has_module_ext(de->d_name, i, NULL) ||
-        !strcmp(de->d_name, MODULE_CONFIG)
-    ) {
-      ok = 0;
-      if(doit == 2) {
-        /*
-         * Copy only modules that are 'new': different size & date. This is
-         * not perfect but will do in this case.
-         */
-        snprintf(buf, sizeof buf, "%s/%s", src_dir, de->d_name);
-        i1 = stat(buf, &sbuf1);
-        snprintf(buf, sizeof buf, "%s/%s", config.module.dir, de->d_name);
-        i2 = stat(buf, &sbuf2);
-        if(!i1 && !i2) {
-          if(sbuf1.st_size == sbuf2.st_size && sbuf1.st_mtime == 
sbuf2.st_mtime) ok = 1;
-        }
-      }
-      if(!ok) {
-        if(doit) {
-          snprintf(buf, sizeof buf, "cp -p %s/%s %s", src_dir, de->d_name, 
config.module.dir);
-          lxrc_run(buf);
-          if(doit == 2) {
-            dia_status(&win, (cnt * 100) / files);
-            if(strcmp(de->d_name, MODULE_CONFIG)) cnt++;
-          }
-        }
-        else {
-          files++;
-        }
-      }
-    }
-  }
+  free(file);
 
-  closedir(d);
-
-  if(doit == 2) {
-    if(cnt) usleep(200000);
-    dia_status_off(&win);
-  }
-
-  return cnt;
+  return NULL;
 }
 
 
@@ -219,15 +180,16 @@
  */
 void mod_init(int autoload)
 {
-  char tmp[256];
+  char *tmp = NULL;
   module_t *ml;
 
   if(!config.net.devices) {
     util_update_netdevice_list(NULL, 1);
   }
 
-  sprintf(tmp, "%s/" MODULE_CONFIG, config.module.dir);
+  strprintf(&tmp, "%s/" MODULE_CONFIG, config.module.dir);
   file_read_modinfo(tmp);
+  free(tmp);
 
   if(autoload && !config.test) {
     for(ml = config.module.list; ml; ml = ml->next) {
@@ -267,26 +229,19 @@
   module_t *ml, **ml1;
   struct dirent *de;
   DIR *d;
-  char buf[32];
-  int i, found;
-  size_t ext_pos;
 
   for(ml1 = &config.module.list; *ml1; ml1 = &(*ml1)->next) (*ml1)->exists = 0;
 
   if(!(d = opendir(config.module.dir))) return;
 
   while((de = readdir(d))) {
-    i = strlen(de->d_name);
-    if(
-      i < (int) sizeof buf &&
-      mod_has_module_ext(de->d_name, i, &ext_pos)
-    ) {
-      strcpy(buf, de->d_name);
-      buf[ext_pos] = 0;
+    if(mod_basename_len(de->d_name)) {
+      char *basename = mod_basename(de->d_name);
+      int found = 0;
 
       for(found = 0, ml = config.module.list; ml; ml = ml->next) {
         /* Don't stop if it is an 'autoload' entry! */
-        if(!strcmp(ml->name, buf)) {
+        if(!strcmp(ml->name, basename)) {
           found = 1;
           ml->exists = 1;
           if(ml->type != 0) break;     /* 0: autoload, cf. file_read_modinfo() 
*/
@@ -298,16 +253,17 @@
         ml = *ml1 = calloc(1, sizeof **ml1);
         ml->exists = 1;
         ml->type = MAX_MODULE_TYPES - 1;       /* reserved for 'other' */
-        ml->name = strdup(buf);
+        ml->name = strdup(basename);
         ml->descr = strdup("");
 
         ml1 = &ml->next;
       }
+
+      free(basename);
     }
   }
 
   closedir(d);
-
 }
 
 
@@ -335,7 +291,7 @@
   int i, width;
 
   if(items) {
-    for(i = 0; i < mods; i++) if(items[i]) free(items[i]);
+    for(i = 0; i < mods; i++) free(items[i]);
     free(items);
     free(mod_items);
   }
@@ -358,7 +314,7 @@
 
   for(i = 0, ml = config.module.list; ml; ml = ml->next) {
     if(ml->type == type && ml->exists && ml->descr) {
-      asprintf(&items[i], "%*s%s%s",
+      strprintf(&items[i], "%*s%s%s",
         width,
         ml->name,
         *ml->descr ? ml->detected ? ml->active ? " * " : " + " : " : " : "", 
ml->descr
@@ -380,7 +336,7 @@
 
 char *mod_get_title(int type)
 {
-  char buf[256], *s = NULL;
+  char *s = NULL;
 
   /* we have translations for these... */
   if(type) {
@@ -395,12 +351,14 @@
     }
   }
 
-  if(!s) {
-    sprintf(buf, "Load %s Modules", config.module.type_name[type]);
-    s = buf;
+  if(s) {
+    s = strdup(s);
+  }
+  else {
+    strprintf(&s, "Load %s Modules", config.module.type_name[type]);
   }
 
-  return strdup(s);
+  return s;
 }
 
 
@@ -532,11 +490,13 @@
 
 void mod_unload_module(char *module)
 {
-  char cmd[300];
+  char *cmd = NULL;
   int err;
 
-  sprintf(cmd, "rmmod %s", module);
+  strprintf(&cmd, "rmmod %s", module);
   err = lxrc_run(cmd);
+  free(cmd);
+
   util_update_kernellog();
 
   if(!err) {
@@ -585,7 +545,6 @@
 
 int mod_load_modules(char *modules, int show)
 {
-  char buf[256];
   int ok = 1;
   slist_t *sl0, *sl;
 
@@ -594,8 +553,10 @@
   for(sl = sl0; sl && ok; sl = sl->next) {
     if(mod_is_loaded(sl->key)) {
       if(show == 2) {
-        sprintf(buf, "Module \"%s\" has already been loaded.", sl->key);
+        char *buf = NULL;
+        strprintf(&buf, "Module \"%s\" has already been loaded.", sl->key);
         dia_message(buf, MSGTYPE_INFO);
+        free(buf);
       }
     }
     else {
@@ -638,7 +599,7 @@
     sl->key = strdup(mod->name);
   }
 
-  if(sl->value) free(sl->value);
+  free(sl->value);
   sl->value = buf2;
 
   return sl->value;
@@ -648,7 +609,7 @@
 void mod_load_module_manual(char *module, int show)
 {
   module_t *ml;
-  char *s, buf[256];
+  char *s;
   window_t win;
   int i;
 
@@ -668,7 +629,9 @@
   }
 
   if(show && s) {
-    sprintf(buf,
+    char *buf = NULL;
+
+    strprintf(&buf,
       "Trying to load module \"%s\"...\n\n"
       "During loading, you may want to watch the kernel messages on virtual 
console 4 (ALT-F4). Use ALT-F1 to switch back to this menu.",
       ml->name
@@ -678,14 +641,16 @@
     win_close(&win);
     i = mod_is_loaded(ml->name);
     if(i) {
-      sprintf(buf, "Module \"%s\" loaded successfully.", ml->name);
+      strprintf(&buf, "Module \"%s\" loaded successfully.", ml->name);
       dia_message(buf, MSGTYPE_INFO);
     }
     else {
       util_beep(FALSE);
-      sprintf(buf, "Failed to load module \"%s\".", ml->name);
+      strprintf(&buf, "Failed to load module \"%s\".", ml->name);
       dia_message(buf, MSGTYPE_ERROR);
     }
+
+    free(buf);
   }
   else {
     mod_insmod(ml->name, s);
@@ -695,8 +660,7 @@
 
 int mod_insmod(char *module, char *param)
 {
-  char buf[512];
-  size_t buf_len;
+  char *buf = NULL;
   int err, cnt;
   slist_t *sl;
   driver_t *drv;
@@ -718,17 +682,23 @@
    */
   unsigned use_modprobe = config.module.modprobe_ok && (config.module.list ? 0 
: 1);
 
-  buf_len = sprintf(buf, "%s %s",
+  strprintf(&buf, "%s %s",
     use_modprobe ? "modprobe" : "insmod",
     config.forceinsmod ? "-f " : ""
   );
 
   /* insmod expects a full path as argument, modprobe not */
-  if (use_modprobe || util_check_exist(module)) {
-    strcpy(buf + buf_len, module);
-  } else {
-    if(!mod_find_module(config.module.dir, module, buf + buf_len))
+  if(use_modprobe || util_check_exist(module)) {
+    strprintf(&buf, "%s%s", buf, module);
+  }
+  else {
+    char *filename = mod_find_module(config.module.dir, module);
+    if(!filename) {
+      free(buf);
       return -1;
+    }
+    strprintf(&buf, "%s%s", buf, filename);
+    free(filename);
   }
 
   if(slist_getentry(config.module.broken, module)) {
@@ -736,7 +706,7 @@
     return -1;
   }
 
-  if(param && *param) sprintf(buf + strlen(buf), " '%s'", param);
+  if(param && *param) strprintf(&buf, "%s '%s'", buf, param);
 
   if(config.run_as_linuxrc) {
     util_update_netdevice_list(NULL, 1);
@@ -748,6 +718,8 @@
 
   err = lxrc_run(buf);
 
+  free(buf);
+
   if(config.module.delay > 0) sleep(config.module.delay);
 
   cnt = 0;
@@ -827,7 +799,7 @@
   file_t *f0, *f;
 
   if(item) {
-    for(i = 0; i < max_mods; i++) if(item[i]) free(item[i]);
+    for(i = 0; i < max_mods; i++) free(item[i]);
     free(item);
     free(mods);
   }
@@ -1005,4 +977,3 @@
 
   file_free_file(f0);
 }
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/module.h new/linuxrc-7.0.26/module.h
--- old/linuxrc-7.0.25/module.h 2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/module.h 2021-01-21 14:52:52.000000000 +0100
@@ -19,8 +19,7 @@
 int        mod_modprobe(char *module, char *param);
 void       mod_show_modules(void);
 void       mod_disk_text(char *buf, int type);
-int        mod_copy_modules(char *src_dir, int doit);
 int        mod_cmp(char *str1, char *str2);
-int        mod_has_module_ext(const char *file, const size_t len,
-               size_t *ext_pos);
-int        mod_find_module(const char *prefix, const char *module, char *file);
+int        mod_basename_len(const char *file);
+char      *mod_basename(const char *file);
+char      *mod_find_module(const char *prefix, const char *module);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/util.c new/linuxrc-7.0.26/util.c
--- old/linuxrc-7.0.25/util.c   2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/util.c   2021-01-21 14:52:52.000000000 +0100
@@ -845,7 +845,7 @@
       strprintf(&buf2, "%s/modules/module.order", dst);
       if(!util_check_exist(buf2) && (f = fopen(buf2, "w"))) {
         while((de = readdir(d))) {
-          if(mod_has_module_ext(de->d_name, strlen(de->d_name), NULL)) {
+          if(mod_basename_len(de->d_name)) {
             fprintf(f, "%s\n", de->d_name);
           }
         }
@@ -1003,7 +1003,9 @@
     }
     if(*buf1) mod_unload_modules(buf1);
     for(f = f0; f; f = f->next) {
-      mod_modprobe(f->key_str, NULL);
+      char *basename = mod_basename(f->key_str);
+      mod_modprobe(basename, NULL);
+      free(basename);
     }
   }
 
@@ -1020,21 +1022,19 @@
  */
 void create_update_name(unsigned idx)
 {
-  char *buf1 = NULL, *mod;
+  char *buf1 = NULL;
   file_t *f0, *f;
-  size_t len;
   module_t *ml;
 
   strprintf(&buf1, "%s/%03u/modules/module.order", config.update.dst, idx);
   f0 = file_read_file(buf1, kf_none);
   for(f = f0; f; f = f->next) {
-    len = strlen(mod = f->key_str);
-    if(len > 2 && !strcmp(mod + len - 2, ".o")) {
-      mod[len - 2] = 0;
-      ml = mod_get_entry(mod);
-      if(ml && ml->descr && *ml->descr) mod = ml->descr;
-      slist_append_str(&config.update.name_list, mod);
-    }
+    char *basename = mod_basename(f->key_str);
+
+    ml = mod_get_entry(basename);
+    slist_append_str(&config.update.name_list, ml && ml->descr && *ml->descr ? 
ml->descr : basename);
+
+    free(basename);
   }
 
   file_free_file(f0);
@@ -1180,7 +1180,6 @@
   add_flag(&sl0, buf, config.ask_language, "ask_lang");
   add_flag(&sl0, buf, config.ask_keytable, "ask_keytbl");
   add_flag(&sl0, buf, config.addswap, "addswap");
-  add_flag(&sl0, buf, config.splash, "splash");
   add_flag(&sl0, buf, config.noshell, "noshell");
   add_flag(&sl0, buf, config.had_segv, "segv");
   add_flag(&sl0, buf, config.scsi_before_usb, "scsibeforeusb");
@@ -1667,48 +1666,52 @@
   free(hd_data);
 }
 
-void util_get_splash_status()
-{
-  FILE *f;
-  char s[80];
-
-  config.splash = 0;
-
-  if((f = fopen("/proc/splash", "r"))) {
-    if(fgets(s, sizeof s, f)) {
-      if(strstr(s, ": on")) config.splash = 1;
-      setenv("SPLASHCFG", "/etc/splash.cfg", 1);
-    }
-    fclose(f);
-  }
-}
-
-
 /*
  * Set splash progress bar to num percent.
  */
-void util_splash_bar(unsigned num, char *trigger)
+void util_splash_bar(unsigned num)
 {
   static unsigned old = 0;
-  char buf[256], buf2[256];
+  char buf[256];
 
-  if(!config.splash) return;
+  if(!config.plymouth) return;
 
   if(num > 100) num = 100;
 
-  num = (num * 65535) / 100;
-
   if(num < old) old = num;
 
-  *buf2 = 0;
-  if(trigger) sprintf(buf2, "-t '%s'", trigger);
-
-  sprintf(buf, "/sbin/splash -p %u:%d %s", old, num - old, buf2);
+  sprintf(buf, "/usr/bin/plymouth system-update --progress=%u", old);
   lxrc_run_console(buf);
 
   old = num;
 }
 
+/*
+ * Set splash message.
+ */
+void util_splash_msg(char *msg)
+{
+  char buf[256];
+
+  if(!config.plymouth) return;
+
+  sprintf(buf, "/usr/bin/plymouth display-message --text=\"%s\"", msg);
+  lxrc_run_console(buf);
+}
+
+/*
+ * Set splash message.
+ */
+void util_splash_mode(char *mode)
+{
+  char buf[256];
+
+  if(!config.plymouth) return;
+
+  sprintf(buf, "/usr/bin/plymouth change-mode --%s", mode);
+  lxrc_run_console(buf);
+}
+
 
 char *read_symlink(char *file)
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-7.0.25/util.h new/linuxrc-7.0.26/util.h
--- old/linuxrc-7.0.25/util.h   2021-01-19 11:15:46.000000000 +0100
+++ new/linuxrc-7.0.26/util.h   2021-01-21 14:52:52.000000000 +0100
@@ -31,8 +31,9 @@
 extern void util_do_driver_updates (void);
 extern int show_driver_updates(void);
 extern void util_status_info       (int log_it);
-extern void util_get_splash_status (void);
-void   util_splash_bar(unsigned num, char *trigger);
+void   util_splash_bar(unsigned num);
+void   util_splash_msg(char *msg);
+void   util_splash_mode(char *mode);
 extern int  util_cp_main           (int argc, char **argv);
 extern int  util_do_cp             (char *src, char *dst);
 extern int  util_swapon_main       (int argc, char **argv);

Reply via email to