Hello community,

here is the log from the commit of package hxtools for openSUSE:Factory checked 
in at 2020-11-17 21:25:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hxtools (Old)
 and      /work/SRC/openSUSE:Factory/.hxtools.new.24930 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hxtools"

Tue Nov 17 21:25:17 2020 rev:41 rq:848793 version:20201116

Changes:
--------
--- /work/SRC/openSUSE:Factory/hxtools/hxtools.changes  2020-07-14 
07:59:50.661897411 +0200
+++ /work/SRC/openSUSE:Factory/.hxtools.new.24930/hxtools.changes       
2020-11-17 21:25:19.773380434 +0100
@@ -1,0 +2,9 @@
+Mon Nov 16 00:09:21 UTC 2020 - Jan Engelhardt <jeng...@inai.de>
+
+- Update to release 20201116
+  * pegrep: cure uninitialized variable warnings
+  * gpsh: change tmp location to /var/tmp
+    (avoid saving potentially large files to tmpfs)
+  * sysinfo: fix null deref when /etc/os-release is absent
+
+-------------------------------------------------------------------

Old:
----
  hxtools-20200712.tar.asc
  hxtools-20200712.tar.xz

New:
----
  hxtools-20201116.tar.asc
  hxtools-20201116.tar.xz

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

Other differences:
------------------
++++++ hxtools.spec ++++++
--- /var/tmp/diff_new_pack.Ap5QGG/_old  2020-11-17 21:25:21.125381775 +0100
+++ /var/tmp/diff_new_pack.Ap5QGG/_new  2020-11-17 21:25:21.129381779 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package hxtools
 #
-# Copyright (c) 2019 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           hxtools
-Version:        20200712
+Version:        20201116
 Release:        0
 Summary:        Collection of day-to-day tools (binaries)
 License:        GPL-2.0+ and WTFPL
@@ -165,11 +165,11 @@
 export is able to smoothen the jagged edges of bitmap fonts.
 
 %prep
-%setup -q
+%autosetup -p1
 
 %build
 %configure
-make %{?_smp_mflags}
+%make_build
 
 %install
 %make_install

++++++ hxtools-20200712.tar.xz -> hxtools-20201116.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/aclocal.m4 
new/hxtools-20201116/aclocal.m4
--- old/hxtools-20200712/aclocal.m4     2020-07-12 11:44:59.283832178 +0200
+++ new/hxtools-20201116/aclocal.m4     2020-11-16 00:15:03.907713152 +0100
@@ -849,6 +849,7 @@
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
   fi
 fi
+AM_SILENT_RULES([yes])
 dnl The trailing newline in this macro's definition is deliberate, for
 dnl backward compatibility and to allow trailing 'dnl'-style comments
 dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/configure 
new/hxtools-20201116/configure
--- old/hxtools-20200712/configure      2020-07-12 11:44:59.919834895 +0200
+++ new/hxtools-20201116/configure      2020-11-16 00:15:04.351715651 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for hxtools 20200712.
+# Generated by GNU Autoconf 2.69 for hxtools 20201116.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@
 # Identity of this package.
 PACKAGE_NAME='hxtools'
 PACKAGE_TARNAME='hxtools'
-PACKAGE_VERSION='20200712'
-PACKAGE_STRING='hxtools 20200712'
+PACKAGE_VERSION='20201116'
+PACKAGE_STRING='hxtools 20201116'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1301,7 +1301,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures hxtools 20200712 to adapt to many kinds of systems.
+\`configure' configures hxtools 20201116 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1367,7 +1367,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of hxtools 20200712:";;
+     short | recursive ) echo "Configuration of hxtools 20201116:";;
    esac
   cat <<\_ACEOF
 
@@ -1486,7 +1486,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-hxtools configure 20200712
+hxtools configure 20201116
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1946,7 +1946,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by hxtools $as_me 20200712, which was
+It was created by hxtools $as_me 20201116, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2811,7 +2811,7 @@
 
 # Define the identity of the package.
  PACKAGE='hxtools'
- VERSION='20200712'
+ VERSION='20201116'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2988,6 +2988,45 @@
     as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
   fi
 fi
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports 
nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+       @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
 
 # Check whether --enable-silent-rules was given.
 if test "${enable_silent_rules+set}" = set; then :
@@ -5936,7 +5975,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by hxtools $as_me 20200712, which was
+This file was extended by hxtools $as_me 20201116, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6002,7 +6041,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-hxtools config.status 20200712
+hxtools config.status 20201116
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/configure.ac 
new/hxtools-20201116/configure.ac
--- old/hxtools-20200712/configure.ac   2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/configure.ac   2020-11-16 00:14:31.000000000 +0100
@@ -1,4 +1,4 @@
-AC_INIT([hxtools], [20200712])
+AC_INIT([hxtools], [20201116])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_HEADERS([config.h])
 AC_PROG_INSTALL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/data/hxtools_dircolors 
new/hxtools-20201116/data/hxtools_dircolors
--- old/hxtools-20200712/data/hxtools_dircolors 2020-07-12 11:44:16.000000000 
+0200
+++ new/hxtools-20201116/data/hxtools_dircolors 2020-11-16 00:14:31.000000000 
+0100
@@ -34,37 +34,26 @@
 #
 .7z    0;31    # 7zip
 .Z     0;31    # LZ77/78 old-style "compress" files
-.ace   0;31    # WinACE
-#.arc  0;31    # SW ARC/PKARC
 .arj   0;31    # Arj
 .bz2   0;31    # BZip2
 .cab   0;31    # Microsoft Cabinet file
 .cpio  0;31    # a different kind of tape archive
 .deb   0;31    # An .a file with cpio.gz in it
 .gz    0;31    # gzip
-#.ice  0;31    # LHICE
 # BIN/CUE explicitly not marked
 .iso   0;31    # ISO-9660 and UDF images
 .jar   0;31    # Jar (Jung Archiver, a new ARJ). Also: ZIP for Java
-#.lha  0;31    # LHARC
 .lz    0;31    # lzip compressed file
-#.lzh  0;31    # LHARC
 .msi   0;31    # Microsoft installer package
-#.pak  0;31    # Pak or Quake1/2
 .pk3   0;31    # ZIP for Quake3 and other games
 .pkg   0;31    # Solaris-style .pkg archives
 .rpm   0;31    # RPM
 .tar   0;31    # Tape Archive
-#.taz  0;31    # Tar / Compress (old)
-#.tbz  0;31    # Tar / BZip1 (old)
-#.tbz2 0;31    # tape archive with bzip2 compression
 .tgz   0;31    # tape archive with gzip compression
 .tlz   0;31    # tape archive with lzip compression
-#.txz  0;31    # tape archive with xz compression
-#.z    0:31    # see .Z
 .xz    0;31    # tukaani xz
 .zip   0;31    # classic PKZIP, Zip, etc.
-.zoo   0;31    # Zoo
+.zst   0;31    # Zstandard
 
 #
 # executables, semi-executables or program code (bright-red)
@@ -72,7 +61,6 @@
 .bat   01;31   # MS-DOS: BAT
 .com   01;31   # MS-DOS: COM
 .exe   01;31   # MS-DOS: EXE
-.pif   01;31   # MS-DOS: PIF
 .dll   01;31
 .so    01;31   # UNIX shared object
 
@@ -82,9 +70,7 @@
 .C     0;32    # C++ program
 .H     0;32    # C++ include files
 .S     0;32    # unpreprocessed GNU Assembler source
-.acs   0;32    # ActionCode script (Doom)
 .asm   0;32    # assembler code
-.bas   0;32    # BASIC program
 .c     0;32    # C program
 .cc    0;32    # C++ program
 .cpp   0;32    # C++ program
@@ -97,37 +83,32 @@
 .pl    0;32    # Perl programs
 .pm    0;32    # Perl modules
 .py    0;32    # Python
+.rb    0;32    # Ruby
+.rs    0;32    # Rust
 .s     0;32    # Precompiled assembler source
 .sh    0;32    # Shell script
 
 #
 # documents (cyan)
 #
-.chm   0;36    # compiled HTML (MS)
 .css   0;36    # Cascading style sheet
 .csv   0;36    # CSV:comma separated values
-#.db   0;36    # Paradox database
-#.dbf  0;36    # DBase database
 .doc   0;36    # Word document
 .docx  0;36    # Word document
-.flv   0;36    # Macromedia container
 .htm   0;36    # HTML file
 .html  0;36    # HTML file
-.lyx   0;36    # LyX word processing file
+.ldif  0;36    # LDAP Interchange Format
 .odt   0;36    # OpenDocument text
 .ods   0;36    # OpenDocument spreadsheet
 .odp   0;36    # OpenDocument presentation
-.pdf   0;36    # Acrobat
+.pdf   0;36
 .po    0;36    # Translations
-.pps   0;36    # Powerpoint Pack&Go presentation/document
+.ps    0;36    # Postscript
 .ppt   0;36    # Powerpoint presentation/document
 .pptx  0;36    # Powerpoint presentation/document
-.reg   0;36    # Windows registry file (MS)
 .rtf   0;36    # Rich Text Format
 .tex   0;36    # latex doc
 .txt   0;36    # text file
-#.url  1;37    # link to the internet
-#.wks  0;36    # Works file
 .xls   0;36    # Excel table/document
 .xlsx  0;36    # Excel table/document
 .xml   0;36    # XML
@@ -135,19 +116,8 @@
 #
 # multimedia (cyan)
 #
-.aif   0;36    # Macintosh AIFF
-.aiff  0;36    # Macintosh AIFF
-.asf   0;36    # Active Streaming Format
-.asx   0;36    # Active Streaming Format
-.AVI   0;36    # Audio-Video Interleaved
 .avi   0;36    # Audio-Video Interleaved
-.au    0;36    # Sun Audio
 .bmp   0;36    # Windows bitmap
-#.cdr  0;36    # CorelDraw file
-#.div  0;36    # Divx
-.divx  0;36    # Divx
-#.drw  0;36    # Micrografx Draw
-.eps   0;36    # Encapsulated PostScript
 .flac  0;36    # Free Lossless Audio
 .gif   0;36    # CompuServer Graphics Interchange Format
 .ico   0;36    # Microsoft bitmap Icon
@@ -155,44 +125,30 @@
 .jpeg  0;36
 .JPG   0;36    # JPEG
 .jpg   0;36    # JPEG
-.m4a   0:36    # MPEG4 container with just audio
+.m4a   0;36    # MPEG4 container with just audio
 .mid   0;36    # MIDI file
 .mka   0;36    # Matroska container (used for audio-only)
 .mkv   0;36    # Matroska container (used for video)
 .mod   0;36    # Fast Tracker Module
-.mov   0;36    # QuickTime Movie
-.mp2   0;36    # MPEG-1 layer 2 audio
 .mp3   0;36    # MPEG-1 layer 3 audio
 .mp4   0;36    # MPEG-4 video
 .mpeg  0;36
 .mpg   0;36    # MPEG video
 .ogg   0;36    # OGG container (usually with Vorbis audio stream)
 .opus  0;36    # OGG container with Opus audio stream
+.otf   0;36    # OpenType CFF font
 .pbm   0;36    # Portable Bitmap
-.pcx   0;36    # ZSoft Paintbrush
 .pgm   0;36    # Portable graymap
 .png   0;36    # Portable Network Graphics
 .ppm   0;36    # Portable Pixelmap
-#.psp  0;36    # Paint Shop Pro
-#.ra   0;36    # RealPlayer Streaming Video
-#.ram  0;36    # RealPlayer Video or link to one
-#.rmi  0;36    # RIFF-MIDI file
 .s3m   0;36    # Scream-Tracker Module
-#.snd  0;36
 .svg   0;36    # Scalable vector graphics
-.tga   0;36    # Targa bitmap
 .tif   0;36    # Tagged Image File Format
 .tiff  0;36
-.ttc   0;36    # TrueType font
+.ttc   0;36    # TrueType font collection
 .ttf   0;36    # TrueType font
 .VOB   0;36    # MPEG-2 DVD Video
 .vob   0;36    # MPEG-2 DVD Video
-#.voc  0;36    # Soundblaster VOC file
 .wav   0;36    # RIFF Wave file
-.wma   0;36    # Windows Media Audio
-.wmf   0;36    # Windows Metafile
-.wmv   0;36    # Windows Media Video
-.xbm   0;36    # X Bitmap
 .xm    0;36    # Fast Tracker Module
 .xpm   0;36    # X Pixmap
-.xvid  0;36    # XviD
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/doc/NEWS.txt 
new/hxtools-20201116/doc/NEWS.txt
--- old/hxtools-20200712/doc/NEWS.txt   2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/doc/NEWS.txt   2020-11-16 00:14:31.000000000 +0100
@@ -1,3 +1,10 @@
+rel-20201116
+============
+* pegrep: cure uninitialized variable warnings
+* gpsh: change tmp location to /var/tmp
+  (avoid saving potentially large files to tmpfs)
+* sysinfo: fix null deref when /etc/os-release is absent
+
 
 rel-20200712
 ============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/doc/xcp.1 
new/hxtools-20201116/doc/xcp.1
--- old/hxtools-20200712/doc/xcp.1      2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/doc/xcp.1      2020-11-16 00:14:31.000000000 +0100
@@ -4,7 +4,7 @@
 xcp \(em proof-of-concept cp(1) with alternate copying mechanisms
 .SH Syntax
 .PP
-\fBxcp\fP [\fB\-m\fP|\fB\-\-mmap\fP] [\fB\-s\fP|\fB\-\-splice\fP]
+\fBxcp\fP [\fB\-d\fP] [\fB\-m\fP|\fB\-\-mmap\fP] [\fB\-s\fP|\fB\-\-splice\fP]
 \fIfromfile\fP \fItofile\fP
 .SH Description
 .PP
@@ -13,8 +13,12 @@
 normally used. mmap may actually be faster than the r/w cycle.
 .SH Options
 .TP
+\fB\-d\fP
+Calls mmap(2) on both the source and destination, and does a memcpy(3).
+.TP
 \fB\-m\fP, \fB\-\-mmap\fP
-Select mmap copying mode. This is the default.
+Calls mmap(2) on the source and uses write(2) for the destination.
 .TP
 \fB\-s\fP, \fB\-\-splice\fP
-Select splice copying mode.
+Calls splice(2) on a pipe(2) pair. This is silly, but it is what it is because
+splice(2) does not support file-to-file transfers.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/kbd/README 
new/hxtools-20201116/kbd/README
--- old/hxtools-20200712/kbd/README     2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/kbd/README     2020-11-16 00:14:31.000000000 +0100
@@ -16,18 +16,6 @@
 font and CONSOLE_UNICODEMAP to /usr/share/kbd/unimaps/cp437.uni.
 
 
-== X FONTS ==
-
-The .bdf are plaintext X font files ("Bitmap Distribution Format"). They
-will need to be converted to .pcf ("Portable Compiled Format"). The PCF
-files are automatically generated by `make`. Afterwards, the PCF files
-can directly be used for and by the X server.
-
-The recommended font path is /usr/share/fonts/misc. Use of the `fxterm`
-wrapper utility in bin/ is preferred to correctly display boldface in
-xterm before version 254.
-
-
 == KEYBOARD MAPS ==
 
 The .map files are (additional!) keyboard maps. They build up upon
@@ -50,6 +38,7 @@
        - left/right tty switch
        - adjusted for SONY VAIO U3 keycodes
 
+
 == FONT OVERVIEW ==
 
 Unless otherwise noted,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/smm/gpsh 
new/hxtools-20201116/smm/gpsh
--- old/hxtools-20200712/smm/gpsh       2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/smm/gpsh       2020-11-16 00:14:31.000000000 +0100
@@ -249,7 +249,7 @@
        # make it even more costly).
        my $ifile = shift @_;
        my $ofile = $ifile;
-       my $tmpdir = "/tmp/psh.$>";
+       my $tmpdir = "/var/tmp/psh.$>";
        my @stat = stat($ifile);
 
        if (!defined($stat[0])) {
@@ -283,7 +283,7 @@
                return;
        }
 
-       my $of = "/tmp/playmuch-$$.it";
+       my $of = "/var/tmp/playmuch-$$.it";
        open(OUT, "> $of");
        read(IN, $buffer, 256);
        $buffer =~ s{^.*?(?=IMP|SCRM|Extended Module)}{}ogs;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/suser/pegrep 
new/hxtools-20201116/suser/pegrep
--- old/hxtools-20200712/suser/pegrep   2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/suser/pegrep   2020-11-16 00:14:31.000000000 +0100
@@ -44,12 +44,14 @@
 sub main
 {
        my $pattern = shift @ARGV;
-       if (length($grepcolor) > 0) {
+       if (defined($grepcolor) && length($grepcolor) > 0) {
                $grepcolor = "\x1b\x5b${grepcolor}m";
                $filecolor = "\x1b\x5b35m";
                $coloncolor = "\x1b\x5b1;30m";
                $linenocolor = "\x1b\x5b36m";
                $stopcolor = "\x1b\x5b0m";
+       } else {
+               $grepcolor = $filecolor = $coloncolor = $linenocolor = 
$stopcolor = "";
        }
        foreach my $file (@ARGV) {
                &dofile($file, $pattern);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/suser/sysinfo.c 
new/hxtools-20201116/suser/sysinfo.c
--- old/hxtools-20200712/suser/sysinfo.c        2020-07-12 11:44:16.000000000 
+0200
+++ new/hxtools-20201116/suser/sysinfo.c        2020-11-16 00:14:31.000000000 
+0100
@@ -448,6 +448,7 @@
        sy_gfx_hardware(&sib);
        sy_display_size(&sib);
        sy_dump(&sib);
-       HXmap_free(sib.osrel);
+       if (sib.osrel != NULL)
+               HXmap_free(sib.osrel);
        return EXIT_SUCCESS;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hxtools-20200712/suser/xcp.c 
new/hxtools-20201116/suser/xcp.c
--- old/hxtools-20200712/suser/xcp.c    2020-07-12 11:44:16.000000000 +0200
+++ new/hxtools-20201116/suser/xcp.c    2020-11-16 00:14:31.000000000 +0100
@@ -23,6 +23,7 @@
 
 enum {
        XCP_MMAP,
+       XCP_MMAP2,
        XCP_SPLICE,
 };
 
@@ -31,12 +32,15 @@
 static bool xcp_get_options(int *argc, const char ***argv)
 {
        static struct HXoption options_table[] = {
+               {.sh = 'd', .ptr = &xcp_mode,
+                .type = HXTYPE_VAL, .val = XCP_MMAP2,
+                .help = "Use mmap(2) for reading and writing"},
                {.sh = 'm', .ln = "mmap", .ptr = &xcp_mode,
                 .type = HXTYPE_VAL, .val = XCP_MMAP,
-                .help = "Use mmap(2) for copying"},
+                .help = "Use mmap(2) for reading, write(2) for writing"},
                {.sh = 's', .ln = "splice", .ptr = &xcp_mode,
                 .type = HXTYPE_VAL, .val = XCP_SPLICE,
-                .help = "Use splice(2) for copying"},
+                .help = "Use splice(2) for reading and writing"},
                HXOPT_AUTOHELP,
                HXOPT_TABLEEND,
        };
@@ -138,6 +142,53 @@
        return EXIT_SUCCESS;
 }
 
+static int xcp_mmap2(const char *input, const char *output)
+{
+       struct stat isb;
+
+       int ifd = open(input, O_RDONLY);
+       if (ifd < 0) {
+               fprintf(stderr, "open(\"%s\"): %s\n", input, strerror(errno));
+               return EXIT_FAILURE;
+       }
+
+       int ofd = open(output, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+       if (ofd < 0) {
+               fprintf(stderr, "open(\"%s\"): %s\n", output, strerror(errno));
+               return EXIT_FAILURE;
+       }
+
+       if (fstat(ifd, &isb) < 0) {
+               perror("fstat");
+               return EXIT_FAILURE;
+       }
+       if (ftruncate(ofd, isb.st_size) != 0) {
+               perror("ftruncate");
+               return EXIT_FAILURE;
+       }
+
+       void *iarea = mmap(NULL, isb.st_size, PROT_READ, MAP_SHARED, ifd, 0);
+       if (iarea == (void *)-1) {
+               perror("mmap");
+               return EXIT_FAILURE;
+       }
+       void *oarea = mmap(NULL, isb.st_size, PROT_WRITE, MAP_PRIVATE, ofd, 0);
+       if (oarea == (void *)-1) {
+               perror("mmap - 2");
+               return EXIT_FAILURE;
+       }
+       close(ifd);
+       close(ofd);
+       madvise(iarea, isb.st_size, MADV_SEQUENTIAL);
+       madvise(oarea, isb.st_size, MADV_SEQUENTIAL);
+       printf("Copying...\n");
+       memcpy(oarea, iarea, isb.st_size);
+       printf("Unmap...\n");
+       munmap(iarea, isb.st_size);
+       munmap(oarea, isb.st_size);
+       return EXIT_SUCCESS;
+}
+
 static int main2(int argc, const char **argv)
 {
        if (!xcp_get_options(&argc, &argv))
@@ -152,6 +203,8 @@
                return xcp_splice(argv[1], argv[2]);
        else if (xcp_mode == XCP_MMAP)
                return xcp_mmap(argv[1], argv[2]);
+       else if (xcp_mode == XCP_MMAP2)
+               return xcp_mmap2(argv[1], argv[2]);
        return EXIT_FAILURE;
 }
 
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to