Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37561128
en ru br
ALT Linux repos
S:7.0.277-alt2

Group :: System/Base
RPM: ploop

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: ploop-7.0.277.patch
Download


 .gear/ploop.spec                                   | 372 +++++++++++++++++++++
 .gear/rules                                        |   4 +
 .../tags/2fa39470e12cd3c1f067736e46275f3f40122b10  |   6 +
 .gear/tags/list                                    |   1 +
 Makefile.inc                                       |   5 +-
 lib/Makefile                                       |   2 +-
 lib/balloon.c                                      |   9 +-
 lib/crypt.c                                        |  17 +-
 lib/delta_sysfs.c                                  |   3 +-
 lib/fsutils.c                                      |   1 +
 lib/merge.c                                        |   5 +-
 lib/ploop.c                                        |  45 ++-
 lib/ploop.h                                        |   6 +-
 lib/snapshot.c                                     |  10 +-
 lib/util.c                                         |   2 +-
 lib/volume.c                                       |   6 +-
 lib/xml.c                                          |   4 +-
 python/Makefile                                    |   4 +-
 python/libploop/__init__.py                        |   4 +-
 python/libploop/libploopmodule.c                   |  34 +-
 python/setup.py                                    |   2 +-
 scripts/crypthelper                                |   4 +-
 scripts/mount.ploop                                |   2 +-
 scripts/umount.ploop                               |   3 +-
 setver.sh                                          |   2 +-
 test/test-pcopy.py                                 |  28 +-
 tools/ploop-volume.c                               |   3 +-
 tools/ploop.c                                      |   2 +-
 28 files changed, 512 insertions(+), 74 deletions(-)
diff --git a/.gear/ploop.spec b/.gear/ploop.spec
new file mode 100644
index 0000000..970601c
--- /dev/null
+++ b/.gear/ploop.spec
@@ -0,0 +1,372 @@
+%define _libexecdir /usr/libexec
+%define _scriptdir %_libexecdir/%name
+
+Name: ploop
+Version: 7.0.277
+Release: alt2
+Group: System/Base
+License: GPLv2
+Summary: Ploop tools
+URL: http://wiki.openvz.org/Ploop
+Vcs: https://src.openvz.org/scm/ovz/ploop.git
+Packager: Viacheslav Dubrovskyi <dubrsl@altlinux.org>
+
+Source: %name-%version.tar
+Patch1: %name-%version.patch
+
+ExclusiveArch: x86_64
+
+BuildRequires(pre): rpm-build-python3
+BuildRequires: python3-dev python3-module-setuptools
+BuildRequires: libxml2-devel libe2fs-devel libuuid-devel libssl-devel libjson-c-devel
+BuildRequires: libdevmapper-devel
+
+%description
+This package contains tools to work with ploop devices and images.
+
+%package -n lib%name
+Summary: ploop library
+Group: System/Libraries
+License: LGPLv2.1
+Conflicts: vzctl < 4.5
+Requires: parted gdisk e2fsprogs lsof
+
+%description -n lib%name
+Parallels loopback (ploop) block device API library
+
+%package -n lib%name-devel
+Summary: Headers for development with ploop library
+Group: Development/C
+License: GPLv2 or LGPLv2.1
+Requires: lib%name = %EVR
+
+%description -n lib%name-devel
+Headers of ploop library
+
+%package -n python3-module-%name
+Summary: Python bindings for %name
+Group: Development/Python
+Requires: lib%name = %EVR
+Provides: python3(libploopapi)
+
+%description -n python3-module-%name
+python3-module-%name contains Python bindings for %name.
+
+%prep
+%setup -q
+%patch1 -p1
+
+%build
+export PYTHON=%__python3
+%add_optflags -Wno-error=deprecated-declarations
+%make_build LIBDIR=%_libdir PLOOP_LOG_FILE=%_logdir/%name.log DEBUG=no all
+
+%install
+export PYTHON=%__python3
+mkdir -p %buildroot%_sbindir
+make \
+    DESTDIR=%buildroot \
+    LIBDIR=%_libdir \
+    PLOOP_LOG_FILE=%_logdir/%name.log \
+    TMPFILESDIR=%_tmpfilesdir \
+    MODULESLOADDIR=%_modulesloaddir \
+    install
+
+rm -f %buildroot%_libdir/libploop.a
+
+%files
+/sbin/*
+%_sbindir/*
+%_man8dir/*
+%_logrotatedir/%name
+%_modulesloaddir/%name.conf
+%_sysconfdir/bash_completion.d/*
+
+%files -n lib%name
+%_libdir/lib%name.so.*
+%_lockdir/%name
+%_tmpfilesdir/*
+%dir %_scriptdir
+%_scriptdir/*
+%dir %_scriptdir-test
+%_scriptdir-test/*
+
+%files -n lib%name-devel
+%_libdir/lib%name.so
+%_includedir/%name
+%_pkgconfigdir/%name.pc
+
+%files -n python3-module-%name
+%python3_sitelibdir/*
+
+%changelog
+* Sun Jul 16 2023 Andrew A. Vasilyev <andy@altlinux.org> 7.0.277-alt2
+- FTBFS: ignore "'MD5' is deprecated: Since OpenSSL 3.0"
+
+* Thu Nov 24 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.277-alt1
+- 7.0.277
+
+* Wed Oct 26 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.276-alt1
+- 7.0.276
+
+* Sat Apr 30 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.272-alt1
+- 7.0.272
+- change fgrep to grep -F
+
+* Mon Jan 17 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.268-alt1
+- 7.0.268
+
+* Tue Dec 21 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.266-alt1
+- 7.0.266
+
+* Tue Aug 24 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.261-alt1
+- 7.0.261
+- remove static library
+
+* Thu Jul 08 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.260-alt1
+- 7.0.260
+
+* Mon May 17 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.259-alt2
+- revert "disable metadata_csum feature for VE fs"
+
+* Fri May 14 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.259-alt1
+- 7.0.259
+- fix e4defrag call
+
+* Mon Apr 19 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.257-alt1
+- 7.0.257
+
+* Tue Mar 30 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.255-alt1
+- 7.0.255
+- disable metadata_csum feature for VE filesystem
+
+* Fri Mar 19 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.254-alt1
+- 7.0.254
+
+* Mon Mar 08 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.248-alt1
+- 7.0.248
+
+* Wed Feb 17 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.246-alt1
+- 7.0.246
+
+* Fri Jan 22 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.241-alt1
+- 7.0.241
+
+* Thu Nov 19 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.240-alt1
+- 7.0.240
+
+* Fri Nov 06 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.237-alt1
+- 7.0.237
+- fix print() spacing style
+
+* Sat Oct 24 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.236-alt1
+- 7.0.236
+
+* Fri Oct 02 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.222-alt1
+- 7.0.222
+
+* Fri Sep 18 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.217-alt1
+- 7.0.217
+
+* Thu Sep 10 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.215-alt1
+- 7.0.215
+
+* Tue Sep 08 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.214-alt1
+- 7.0.214
+- minor spec cleanup
+
+* Thu Aug 27 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.211-alt1
+- 7.0.211
+- fix strncpy truncation error
+
+* Tue Aug 04 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.209-alt1
+- 7.0.209
+
+* Fri Jul 24 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.207-alt1
+- 7.0.207
+
+* Tue Jul 21 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.206-alt1
+- 7.0.206
+
+* Sun Jul 19 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.204-alt1
+- 7.0.204
+
+* Wed Jun 17 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.203-alt1
+- 7.0.203
+
+* Mon Jun 01 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.200-alt1
+- 7.0.200
+
+* Mon Apr 27 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.196-alt1
+- 7.0.196
+
+* Tue Apr 07 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.193-alt1
+- 7.0.193
+
+* Mon Mar 30 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.190-alt1
+- 7.0.190
+
+* Fri Mar 20 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.188-alt1
+- 7.0.188
+
+* Tue Mar 10 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.187-alt1
+- 7.0.187
+
+* Wed Feb 26 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.184-alt1
+- 7.0.184
+
+* Wed Feb 19 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.183-alt1
+- 7.0.183
+
+* Fri Feb 14 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.182-alt1
+- 7.0.182
+
+* Tue Feb 11 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.181-alt1
+- 7.0.181
+
+* Mon Feb 10 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.179-alt1
+- 7.0.179
+
+* Fri Feb 07 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.178-alt1
+- 7.0.178
+
+* Wed Feb 05 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.177-alt1
+- 7.0.177
+
+* Mon Feb 03 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.176-alt1
+- 7.0.176
+
+* Thu Jan 30 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.175-alt1
+- 7.0.175
+
+* Wed Jan 29 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.174-alt1
+- 7.0.174
+
+* Tue Jan 28 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.173-alt1
+- 7.0.173
+
+* Mon Jan 27 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.172-alt1
+- 7.0.172
+
+* Mon Jan 27 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.171-alt1
+- 7.0.171
+
+* Thu Jan 23 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.170-alt1
+- 7.0.170
+
+* Wed Jan 22 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.169-alt1
+- 7.0.169
+
+* Tue Jan 21 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.168-alt1
+- 7.0.168
+
+* Fri Jan 10 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.167-alt1
+- 7.0.167
+
+* Fri Dec 20 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.166-alt1
+- 7.0.166
+
+* Thu Dec 19 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.165-alt1
+- 7.0.165
+
+* Thu Dec 05 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt7
+- build only for x86_64
+- fix License
+
+* Wed Dec 04 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt6
+- reduce the changes from upstream
+
+* Thu Oct 31 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt5
+- make python3 convertion closer to upstream style
+
+* Wed Oct 30 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt4
+- fix compilation warnings on snprintf/strncpy calls
+
+* Fri Oct 25 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt3
+- enable ELF verify
+
+* Thu Oct 17 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt2
+- convert to python3
+
+* Mon Sep 30 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.163-alt1
+- 7.0.163
+
+* Fri Sep 20 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.162-alt2
+- fix e4defrag command line arguments
+
+* Fri Sep 20 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.162-alt1
+- 7.0.162
+
+* Wed Sep 18 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.161-alt1
+- 7.0.161
+
+* Fri Aug 16 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.160-alt1
+- 7.0.160
+
+* Sun Nov 04 2018 Alexey Shabalin <shaba@altlinux.org> 7.0.132-alt1
+- 7.0.132
+
+* Mon Feb 26 2018 Alexey Shabalin <shaba@altlinux.ru> 7.0.126-alt1
+- 7.0.126
+
+* Fri Feb 09 2018 Alexey Shabalin <shaba@altlinux.ru> 7.0.124-alt1
+- Updated to 7.0.124
+- add python package
+
+* Fri Jul 28 2017 Aleksei Nikiforov <darktemplar@altlinux.org> 1.15-alt2
+- Fixed build with new toolchain
+
+* Sun May 01 2016 Gleb F-Malinovskiy <glebfm@altlinux.org> 1.15-alt1
+- Updated to 1.15.
+
+* Tue Sep 22 2015 Terechkov Evgenii <evg@altlinux.org> 1.14.1-alt1
+- New version
+- Add pkg-config support
+
+* Tue Sep 22 2015 Terechkov Evgenii <evg@altlinux.org> 1.14-alt1
+- New version
+
+* Tue Apr 21 2015 Terechkov Evgenii <evg@altlinux.org> 1.13.2-alt1
+- New version
+
+* Thu Apr 16 2015 Terechkov Evgenii <evg@altlinux.org> 1.13-alt1
+- New version
+
+* Sat Jan  3 2015 Terechkov Evgenii <evg@altlinux.org> 1.12.2-alt1
+- New version
+
+* Fri Sep  5 2014 Terechkov Evgenii <evg@altlinux.org> 1.12.1-alt1
+- New version
+
+* Thu Jul 31 2014 Terechkov Evgenii <evg@altlinux.org> 1.12-alt1
+- New version
+
+* Tue Jul  1 2014 Evgenii Terechkov <evg@altlinux.org> 1.11-alt1
+- New version
+
+* Sat Dec 28 2013 Slava Dubrovskiy <dubrsl@altlinux.org> 1.10-alt1
+- New version
+
+* Sun Oct 20 2013 Slava Dubrovskiy <dubrsl@altlinux.org> 1.9-alt1
+- New version
+
+* Mon Aug 05 2013 Slava Dubrovskiy <dubrsl@altlinux.org> 1.8-alt1
+- New version
+
+* Tue Jan 29 2013 Slava Dubrovskiy <dubrsl@altlinux.org> 1.6-alt1
+- New version
+
+* Thu Jun 14 2012 Slava Dubrovskiy <dubrsl@altlinux.org> 1.4-alt1
+- New version
+
+* Wed Apr 18 2012 Slava Dubrovskiy <dubrsl@altlinux.org> 1.2-alt1
+- New version
+
+* Sat Mar 24 2012 Slava Dubrovskiy <dubrsl@altlinux.org> 1.1-alt1
+- Update to bb3948d45daf3e30d0e05f20d1442376237ac49d
+
+* Tue Mar 13 2012 Slava Dubrovskiy <dubrsl@altlinux.org> 1.0-alt1
+- build for ALT
+
+* Tue Mar 13 2012 Kir Kolyshkin <kir@openvz.org> 1.0-1
+- initial version
diff --git a/.gear/rules b/.gear/rules
new file mode 100644
index 0000000..38ab285
--- /dev/null
+++ b/.gear/rules
@@ -0,0 +1,4 @@
+spec: .gear/ploop.spec
+tar: v@version@:.
+diff: v@version@:. . name=@name@-@version@.patch
+copy?: .gear/*.patch
diff --git a/.gear/tags/2fa39470e12cd3c1f067736e46275f3f40122b10 b/.gear/tags/2fa39470e12cd3c1f067736e46275f3f40122b10
new file mode 100644
index 0000000..64fc9df
--- /dev/null
+++ b/.gear/tags/2fa39470e12cd3c1f067736e46275f3f40122b10
@@ -0,0 +1,6 @@
+object 0c9d6c8e8198a000eb42cb7691e1187b2279e970
+type commit
+tag v7.0.277
+tagger Apache <apache@kojihub.eng.sw.ru> 1669033841 +0300
+
+AUTO v7.0.277 tag
diff --git a/.gear/tags/list b/.gear/tags/list
new file mode 100644
index 0000000..ead82db
--- /dev/null
+++ b/.gear/tags/list
@@ -0,0 +1 @@
+2fa39470e12cd3c1f067736e46275f3f40122b10 v7.0.277
diff --git a/Makefile.inc b/Makefile.inc
index 35255b7..460d2e6 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -36,9 +36,10 @@ DEBUG=yes
 
 CFLAGS := $(if $(DEBUG),-g -O0 -DDEBUG,-O2) $(CFLAGS)
 CFLAGS += -I. -I../include -fno-strict-aliasing \
-	-Wall -Wstrict-prototypes -Werror -Wformat-security \
+	-Wall -Wstrict-prototypes -Werror -Wformat-security -Werror=format-truncation=0 \
 	-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
-	-DPRODUCT_NAME_SHORT=\"$(PRODUCT_NAME_SHORT)\" -Werror=maybe-uninitialized
+	-DPRODUCT_NAME_SHORT=\"$(PRODUCT_NAME_SHORT)\"
+# disabled -Werror
 CFLAGS += $(RPM_OPT_FLAGS) $(CPPFLAGS)
 CFLAGS += $(if $(PLOOP_LOG_FILE), -DPLOOP_LOG_FILE=\"$(PLOOP_LOG_FILE)\")
 #CFLAGS += -DDEBUG_TIMES
diff --git a/lib/Makefile b/lib/Makefile
index 009faaa..f67f4e7 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -98,7 +98,7 @@ install: all install-lockdir install-pc
 	$(E) "  INSTALL " $(LIBPLOOP)
 	$(Q) $(INSTALL) -m 644 $(LIBPLOOP) $(DESTDIR)$(LIBDIR)
 	$(E) "  INSTALL " $(LIBPLOOP_SO_X_Y)
-	$(Q) $(INSTALL) -m 755 $(LIBPLOOP_SO_X_Y) $(DESTDIR)$(LIBDIR)
+	$(Q) $(INSTALL) -m 644 $(LIBPLOOP_SO_X_Y) $(DESTDIR)$(LIBDIR)
 	$(E) "  INSTALL " $(LIBPLOOP_SO_X) $(LIBPLOOP_SO)
 	$(Q) cp -a $(LIBPLOOP_SO_X) $(LIBPLOOP_SO) $(DESTDIR)$(LIBDIR)
 .PHONY: install
diff --git a/lib/balloon.c b/lib/balloon.c
index 81b9106..0ee8240 100644
--- a/lib/balloon.c
+++ b/lib/balloon.c
@@ -35,6 +35,7 @@
 #include <linux/types.h>
 #include <linux/fs.h>
 #include <string.h>
+#include <sys/sysmacros.h>
 
 #include "ploop.h"
 #include "ploop_if.h"
@@ -42,7 +43,7 @@
 
 #define EXT4_IOC_OPEN_BALLOON		_IO('f', 42)
 
-#define BIN_E4DEFRAG2	"/usr/sbin/e4defrag2"
+#define BIN_E4DEFRAG2	"/sbin/e4defrag"
 #define BIN_E4DEFRAG	"/usr/sbin/ploop-e4defrag"
 
 
@@ -1507,7 +1508,8 @@ static int do_defrag(struct ploop_disk_images_data *di,
 	char pidfile[PATH_MAX];
 	char block_size[16];
 	char part[64];
-	char *arg[] = {BIN_E4DEFRAG2, "-c", block_size, part, (char*)mnt, NULL};
+	/* char *arg[] = {BIN_E4DEFRAG2, "-c", block_size, part, (char*)mnt, NULL}; */
+	char *arg[] = {BIN_E4DEFRAG2, "-c", part, NULL};
 
 	if (access(arg[0], F_OK))
 		return 0;
@@ -1678,7 +1680,8 @@ static int do_mntn_merge(struct ploop_disk_images_data *di, const char *device,
 		goto err;
 	}
 
-	snprintf(x, sizeof(x), "%s.tmp", conf);
+	if (snprintf(x, sizeof(x), "%s.tmp", conf) < 0)
+		goto err;
 	ret = ploop_store_diskdescriptor(x, di);
 	if (ret)
 		goto err;
diff --git a/lib/crypt.c b/lib/crypt.c
index 26595fe..d9ab54e 100644
--- a/lib/crypt.c
+++ b/lib/crypt.c
@@ -230,13 +230,19 @@ static int encrypt_image(struct ploop_disk_images_data *di,
 		return SYSEXIT_MKDIR;
 	}
 
-	snprintf(image, sizeof(image), "%s/%s", dir,
-			get_basename(di->images[0]->file));
+	if (snprintf(image, sizeof(image), "%s/%s", dir,
+			get_basename(di->images[0]->file)) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	ret = ploop_create_image(&c_enc);
 	if (ret)
 		goto err;
 
-	snprintf(ddxml, sizeof(ddxml), "%s/" DISKDESCRIPTOR_XML, dir);
+	if (snprintf(ddxml, sizeof(ddxml), "%s/" DISKDESCRIPTOR_XML, dir) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	ret = ploop_open_dd(&di_enc, ddxml);
 	if (ret)
 		goto err;
@@ -364,7 +370,10 @@ static int change_key(struct ploop_disk_images_data *di,
 		goto err;
 
 	get_disk_descriptor_fname(di, ddxml, sizeof(ddxml));
-	snprintf(tmp, sizeof(tmp), "%s.tmp", ddxml);
+	if (snprintf(tmp, sizeof(tmp), "%s.tmp", ddxml) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	ret = set_encryption_keyid(di, param->keyid);
 	if (ret)
 		goto err;
diff --git a/lib/delta_sysfs.c b/lib/delta_sysfs.c
index f2a2c5f..44a8588 100644
--- a/lib/delta_sysfs.c
+++ b/lib/delta_sysfs.c
@@ -30,6 +30,7 @@
 #include <linux/fs.h>
 #include <sys/ioctl.h>
 #include <sys/utsname.h>
+#include <sys/sysmacros.h>
 
 #include "ploop.h"
 
@@ -549,7 +550,7 @@ int ploop_get_dev_by_delta(const char *delta, const char *topdelta,
 	char fname[PATH_MAX];
 	char delta_r[PATH_MAX];
 	char topdelta_r[PATH_MAX];
-	char dev[64];
+	char dev[PATH_MAX];
 	DIR *dp;
 	struct dirent *de;
 	int ret = -1;
diff --git a/lib/fsutils.c b/lib/fsutils.c
index 1241583..e110d16 100644
--- a/lib/fsutils.c
+++ b/lib/fsutils.c
@@ -27,6 +27,7 @@
 #include <limits.h>
 #include <sys/ioctl.h>
 #include <sys/vfs.h>
+#include <sys/sysmacros.h>
 
 #include "ploop.h"
 #ifndef EXT4_IOC_SET_RSV_BLOCKS
diff --git a/lib/merge.c b/lib/merge.c
index 07a3fc5..4766908 100644
--- a/lib/merge.c
+++ b/lib/merge.c
@@ -942,7 +942,10 @@ int ploop_merge_snapshot_by_guid(struct ploop_disk_images_data *di,
 	 */
 	parent_guid = NULL;
 
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
 	if (ret)
 		goto err;
diff --git a/lib/ploop.c b/lib/ploop.c
index c62c63c..560014b 100644
--- a/lib/ploop.c
+++ b/lib/ploop.c
@@ -1858,7 +1858,10 @@ int ploop_replace_image(struct ploop_disk_images_data *di,
 
 	/* Write new dd.xml with changed image file */
 	get_disk_descriptor_fname(di, conf, sizeof(conf));
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	tmp = di->images[idx]->file;
 	di->images[idx]->file = file;
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
@@ -1893,7 +1896,8 @@ int ploop_replace_image(struct ploop_disk_images_data *di,
 			 * We need to create a hardlink to it,
 			 * rename the file, then remove the hardlink.
 			 */
-			snprintf(tmp, sizeof(tmp), "%s.XXXXXX", file);
+			if (snprintf(tmp, sizeof(tmp), "%s.XXXXXX", file) < 0)
+				goto err;
 			tmpfd = mkstemp(tmp);
 			if (tmpfd < 0) {
 				ploop_err(errno, "Can't mkstemp(%s)", tmp);
@@ -1983,7 +1987,8 @@ static int create_ploop_dev(int minor)
 			return SYSEXIT_SYS;
 		}
 	}
-	snprintf(devicep1, sizeof(devicep1), "%sp1", device);
+	if (snprintf(devicep1, sizeof(devicep1), "%sp1", device) < 0)
+		return SYSEXIT_PARAM;
 	if (access(devicep1, F_OK)) {
 		if (mknod(devicep1, S_IFBLK, makedev(PLOOP_DEV_MAJOR, minor+1))) {
 			ploop_err(errno, "mknod %s", devicep1);
@@ -2180,8 +2185,11 @@ static int add_deltas(struct ploop_disk_images_data *di,
 		if (lckfd == -1)
 			return SYSEXIT_DEVICE;
 
-		snprintf(device, sizeof(param->device), "/dev/%s",
-				make_sysfs_dev_name(minor, buf, sizeof(buf)));
+		if (snprintf(device, sizeof(param->device), "/dev/%s",
+				make_sysfs_dev_name(minor, buf, sizeof(buf))) < 0) {
+			ret = SYSEXIT_PARAM;
+			goto err;
+		}
 		ret = create_ploop_dev(minor);
 		if (ret)
 			goto err;
@@ -2196,8 +2204,11 @@ static int add_deltas(struct ploop_disk_images_data *di,
 
 	if (di != NULL && di->runtime->component_name != NULL) {
 		req.c.pctl_flags |= PLOOP_FLAG_COOKIE;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
 		strncpy(req.cookie, di->runtime->component_name,
 				PLOOP_COOKIE_SIZE);
+#pragma GCC diagnostic pop
 	}
 	req.c.pctl_cluster_log = ffs(blocksize) - 1;
 	req.c.pctl_size = 0;
@@ -2989,7 +3000,10 @@ int ploop_grow_image(struct ploop_disk_images_data *di, off_t size, int sparse)
 	// Update size in the DiskDescriptor.xml
 	di->size = size;
 	get_disk_descriptor_fname(di, conf, sizeof(conf));
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
 	if (ret)
 		goto err;
@@ -3025,7 +3039,8 @@ int ploop_grow_image(struct ploop_disk_images_data *di, off_t size, int sparse)
 			ret = mount_image(di, &m);
 			if (ret)
 				goto err;
-			snprintf(device, sizeof(device), "%s", m.device);
+			if (snprintf(device, sizeof(device), "%s", m.device) < 0)
+				goto err;
 		}
 	}
 
@@ -3263,7 +3278,10 @@ int ploop_resize_image(struct ploop_disk_images_data *di, struct ploop_resize_pa
 		// Update size in the DiskDescriptor.xml
 		di->size = new_size;
 		get_disk_descriptor_fname(di, conf, sizeof(conf));
-		snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+		if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0) {
+			ret = SYSEXIT_PARAM;
+			goto err;
+		}
 		ret = ploop_store_diskdescriptor(conf_tmp, di);
 		if (ret)
 			goto err;
@@ -3449,8 +3467,10 @@ static int expanded2raw(struct ploop_disk_images_data *di)
 	if (p_memalign(&buf, 4096, cluster))
 		goto err;
 
-	snprintf(tmp, sizeof(tmp), "%s.tmp",
-			di->images[0]->file);
+	if (snprintf(tmp, sizeof(tmp), "%s.tmp",
+			di->images[0]->file) < 0)
+		goto err;
+
 	if (open_delta_simple(&odelta, tmp, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, OD_OFFLINE))
 		goto err;
 
@@ -3600,7 +3620,10 @@ int ploop_convert_image(struct ploop_disk_images_data *di, int mode, int flags)
 
 	di->mode = mode;
 	get_disk_descriptor_fname(di, conf, sizeof(conf));
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0) {
+		ret = SYSEXIT_PARAM;
+		goto err;
+	}
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
 	if (ret)
 		goto err;
diff --git a/lib/ploop.h b/lib/ploop.h
index 63650aa..e4444b0 100644
--- a/lib/ploop.h
+++ b/lib/ploop.h
@@ -82,10 +82,10 @@
 #define PLOOP_LOCK_DIR	"/var/lock/ploop"
 
 /* PATH used by the library */
-#define DEF_PATH_ENV	"PATH=/sbin:/bin:/usr/sbin:/usr/bin:" \
+#define DEF_PATH_ENV	"PATH=/sbin:/usr/sbin:/bin:/usr/bin:" \
 			"/usr/local/sbin:/usr/local/bin"
-#define DEF_PATH_LIST	{ "/sbin", "/bin", "/usr/sbin", "/usr/bin", \
-			"/usr/local/sbin", "/usr/bin", NULL }
+#define DEF_PATH_LIST	{ "/sbin", "/usr/sbin", "/bin", "/usr/bin", \
+			"/usr/local/sbin", "/usr/local/bin", NULL }
 
 enum {
 	CRYPT_NONE,
diff --git a/lib/snapshot.c b/lib/snapshot.c
index d3a791b..49e147e 100644
--- a/lib/snapshot.c
+++ b/lib/snapshot.c
@@ -27,6 +27,7 @@
 #include <limits.h>
 #include <sys/ioctl.h>
 #include <uuid/uuid.h>
+#include <sys/sysmacros.h>
 
 #include "ploop.h"
 #include "cbt.h"
@@ -501,7 +502,8 @@ int do_create_snapshot(struct ploop_disk_images_data *di,
 		return ret;
 
 	get_disk_descriptor_fname(di, conf, sizeof(conf));
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0)
+		return SYSEXIT_PARAM;
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
 	if (ret)
 		return ret;
@@ -768,7 +770,8 @@ static int reset_top_delta(struct ploop_disk_images_data *di,
 	ploop_di_change_guid(di, guid, TOPDELTA_UUID);
 
 	get_disk_descriptor_fname(di, conf, sizeof(conf));
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0)
+		goto err;
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
 	if (ret)
 		goto err;
@@ -907,7 +910,8 @@ int ploop_switch_snapshot_ex(struct ploop_disk_images_data *di,
 		goto err_cleanup1;
 
 	get_disk_descriptor_fname(di, conf, sizeof(conf));
-	snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf);
+	if (snprintf(conf_tmp, sizeof(conf_tmp), "%s.tmp", conf) < 0)
+		goto err_cleanup1;
 	ret = ploop_store_diskdescriptor(conf_tmp, di);
 	if (ret)
 		goto err_cleanup1;
diff --git a/lib/util.c b/lib/util.c
index 21d0f29..5adb363 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -445,7 +445,7 @@ static char *parse_line(char *str, char *out, int lsz)
 int read_conf(struct conf_data *conf)
 {
 	char buf[64 * 2];
-	char name[64];
+	char name[64 * 2 + 1];
 	char *val;
 	FILE *f;
 
diff --git a/lib/volume.c b/lib/volume.c
index 8bfd3d4..37e19ee 100644
--- a/lib/volume.c
+++ b/lib/volume.c
@@ -271,7 +271,8 @@ static int get_first_sibling(const char *path, char *out, int size)
 		if (de->d_type != DT_LNK)
 			continue;
 		if (n == 0) {
-			snprintf(out, size, "%s/%s", buf, de->d_name);
+			if (snprintf(out, size, "%s/%s", buf, de->d_name) < 0)
+			    return -1;
 			char *f = realpath(out, NULL);
 			if (f == NULL) {
 				ploop_err(errno, "realpath(%s)", out);
@@ -701,7 +702,8 @@ int ploop_volume_get_tree(const char *path, struct ploop_volume_list_head *out,
 		if (de->d_type != DT_LNK)
 			continue;
 
-		snprintf(buf, sizeof(buf), "%s/%s", spath, de->d_name);
+		if (snprintf(buf, sizeof(buf), "%s/%s", spath, de->d_name) < 0)
+			goto err;
 		char *f = realpath(buf, NULL);
 		if (f == NULL) {
 			ploop_err(errno, "realpath(%s)", buf);
diff --git a/lib/xml.c b/lib/xml.c
index 29a14bc..33eb84c 100644
--- a/lib/xml.c
+++ b/lib/xml.c
@@ -548,7 +548,7 @@ int read_dd(struct ploop_disk_images_data *di)
 	}
 	root_element = xmlDocGetRootElement(doc);
 
-	get_basedir(fname, basedir, sizeof(basedir));
+	get_basedir(fname, basedir, sizeof(basedir) - 1);
 	ret = parse_xml(basedir, root_element, di);
 	if (ret == 0)
 		ret = validate_disk_descriptor(di);
@@ -677,7 +677,7 @@ int store_diskdescriptor(const char *fname, struct ploop_disk_images_data *di,
 	if (di->runtime->xml_fname == NULL)
 		di->runtime->xml_fname = strdup(fname);
 
-	get_basedir(fname, tmp, sizeof(tmp));
+	get_basedir(fname, tmp, sizeof(tmp) - 1);
 	if (tmp[0] == '\0')
 		strcpy(tmp, "./");
 
diff --git a/python/Makefile b/python/Makefile
index 502b164..6204c36 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -3,7 +3,7 @@ PLOOPROOT = ..
 include $(PLOOPROOT)/Makefile.inc
 
 all:
-	$(Q) CFLAGS= python setup.py build
+	$(Q) CFLAGS= python3 setup.py build
 .PHONY: all
 
 clean:
@@ -15,6 +15,6 @@ distclean: clean
 .PHONY: distclean
 
 install:
-	$(Q) CFLAGS= python setup.py install \
+	$(Q) CFLAGS= python3 setup.py install \
 		$(if $(DESTDIR), --root $(DESTDIR))
 .PHONY: install
diff --git a/python/libploop/__init__.py b/python/libploop/__init__.py
index 49f5c0d..3e7f9bb 100755
--- a/python/libploop/__init__.py
+++ b/python/libploop/__init__.py
@@ -2,9 +2,9 @@ import libploopapi
 import threading
 
 class ploopcopy():
-	def __init__(self, ddxml, fd, async = 0):
+	def __init__(self, ddxml, fd, _async = 0):
 		self.di = libploopapi.open_dd(ddxml)
-		self.h = libploopapi.copy_init(self.di, fd, async)
+		self.h = libploopapi.copy_init(self.di, fd, _async)
 
 	def __del__(self):
 		if self.h:
diff --git a/python/libploop/libploopmodule.c b/python/libploop/libploopmodule.c
index 21e7792..c14e5be 100644
--- a/python/libploop/libploopmodule.c
+++ b/python/libploop/libploopmodule.c
@@ -18,8 +18,8 @@ typedef struct {
 
 static int is_valid_object(PyObject *obj, const char *name)
 {
-	return (PyCObject_Check(obj) &&
-			strcmp((char *)PyCObject_GetDesc(obj), name) == 0);
+	return (PyCapsule_CheckExact(obj) &&
+			strcmp(PyCapsule_GetName(obj), name) == 0);
 }
 
 static int is_ploop_di_object(PyObject *obj)
@@ -51,7 +51,7 @@ static PyObject *libploop_open_dd(PyObject *self, PyObject *args)
 		return NULL;
 	}
 
-	return PyCObject_FromVoidPtrAndDesc(di, ploop_di_object_t, NULL);
+	return PyCapsule_New(di, ploop_di_object_t, NULL);
 }
 
 static PyObject *libploop_close_dd(PyObject *self, PyObject *args)
@@ -98,7 +98,7 @@ static PyObject *libploop_copy_init(PyObject *self, PyObject *args)
 		return NULL;
 	}
 
-	return PyCObject_FromVoidPtrAndDesc(h, ploop_copy_handle_object_t, NULL);
+	return PyCapsule_New(h, ploop_copy_handle_object_t, NULL);
 }
 
 static PyObject *libploop_copy_start(PyObject *self, PyObject *args)
@@ -253,7 +253,7 @@ static PyObject *libploop_create_snapshot(PyObject *self, PyObject *args)
 		return NULL;
 	}
 
-	return PyString_FromString(param.guid);
+	return PyUnicode_FromString(param.guid);
 }
 
 static PyObject *libploop_create_snapshot_offline(PyObject *self, PyObject *args)
@@ -285,7 +285,7 @@ static PyObject *libploop_create_snapshot_offline(PyObject *self, PyObject *args
 		return NULL;
 	}
 
-	return PyString_FromString(param.guid);
+	return PyUnicode_FromString(param.guid);
 }
 
 static PyObject *libploop_delete_snapshot(PyObject *self, PyObject *args)
@@ -340,7 +340,7 @@ static PyObject *libploop_get_top_delta_fname(PyObject *self, PyObject *args)
 		return NULL;
 	}
 
-	return PyString_FromString(buf);
+	return PyUnicode_FromString(buf);
 }
 
 static PyMethodDef PloopMethods[] = {
@@ -361,11 +361,19 @@ static PyMethodDef PloopMethods[] = {
 	{ NULL, NULL, 0, NULL }
 };
 
-PyMODINIT_FUNC initlibploopapi(void)
-{
-	PyObject *m;
+static struct PyModuleDef moduledef = {
+        PyModuleDef_HEAD_INIT,
+        "libploopapi",     /* m_name */
+        "wrapper to ploop library",  /* m_doc */
+        -1,                  /* m_size */
+        PloopMethods,    /* m_methods */
+        NULL,                /* m_reload */
+        NULL,                /* m_traverse */
+        NULL,                /* m_clear */
+        NULL,                /* m_free */
+};
 
-	m = Py_InitModule("libploopapi", PloopMethods);
-	if (m == NULL)
-		return;
+PyMODINIT_FUNC PyInit_libploopapi(void)
+{
+	return PyModule_Create(&moduledef);
 }
diff --git a/python/setup.py b/python/setup.py
index 043199a..a17ad77 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/python3
 
 from distutils.core import setup, Extension
 
diff --git a/scripts/crypthelper b/scripts/crypthelper
index ecbe91e..a2346ce 100644
--- a/scripts/crypthelper
+++ b/scripts/crypthelper
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 from __future__ import print_function
 import sys
@@ -24,7 +24,7 @@ def get_key(key_id):
         sys.exit(2)
 
 def run_cryptsetup(cmdline, data = None):
-    proc = subprocess.Popen(['/usr/sbin/cryptsetup'] + cmdline,
+    proc = subprocess.Popen(['/sbin/cryptsetup'] + cmdline,
         stdin = subprocess.PIPE)
     proc.communicate(data)
     return proc.returncode
diff --git a/scripts/mount.ploop b/scripts/mount.ploop
index 206b492..96fd376 100755
--- a/scripts/mount.ploop
+++ b/scripts/mount.ploop
@@ -110,7 +110,7 @@ fi
 
 # Make sure we have sane PATH
 for P in /sbin /usr/sbin /usr/local/sbin; do
-	if ! echo ":${PATH}:" | fgrep -q ":${P}:"; then
+	if ! echo ":${PATH}:" | grep -Fq ":${P}:"; then
 		PATH="$P:$PATH"
 	fi
 done
diff --git a/scripts/umount.ploop b/scripts/umount.ploop
index a15f110..dbe5696 100755
--- a/scripts/umount.ploop
+++ b/scripts/umount.ploop
@@ -22,7 +22,6 @@
 
 PLOOP="ploop"
 MOUNT_POINT=""
-PLOOP_DEV=""
 MTAB="/etc/mtab"
 DESCRIPTOR="DiskDescriptor.xml"
 
@@ -36,7 +35,7 @@ mangle() {
 
 # Make sure we have sane PATH
 for P in /sbin /usr/sbin /usr/local/sbin; do
-	if ! echo ":${PATH}:" | fgrep -q ":${P}:"; then
+	if ! echo ":${PATH}:" | grep -Fq ":${P}:"; then
 		PATH="$P:$PATH"
 	fi
 done
diff --git a/setver.sh b/setver.sh
index 16896b3..2691bfa 100755
--- a/setver.sh
+++ b/setver.sh
@@ -112,7 +112,7 @@ MF_V=$(awk -F = '($1 == "VERSION") { print $2; }' $MAKEFILE)
 MF_R=$(awk -F = '($1 == "RELEASE") { print $2; }' $MAKEFILE)
 GIT_R_MF="-$GIT_RT"
 test "$GIT_RT" = "1" && GIT_R_MF=""
-if test "$GIT_V" != "$MF_V" -o "$GIT_R_MF" != "MF_R"; then
+if test "$GIT_V" != "$MF_V" -o "$GIT_R_MF" != "$MF_R"; then
 	test -z "$verbose" || echo "Changing $MAKEFILE:"
 	# VERSION=1.12
 	# RELEASE=
diff --git a/test/test-pcopy.py b/test/test-pcopy.py
index cb7d37b..049f7ff 100755
--- a/test/test-pcopy.py
+++ b/test/test-pcopy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 import libploop
 import shutil
 import io
@@ -16,7 +16,7 @@ def hashfile(afile, hasher, blocksize=65536):
 	while len(buf) > 0:
 		hasher.update(buf)
 		buf = afile.read(blocksize)
-	print (hasher.hexdigest())
+	print(hasher.hexdigest())
 	return hasher.hexdigest()
 
 
@@ -26,12 +26,12 @@ def start_image_filller():
 		os.execl('/bin/dd',  'dd', 'if=/dev/urandom', "of=/dev/ploop0", 'bs=4096', 'count=1310720', 'oflag=direct')
 		os._exit(1)
 	else:
-		print "Start filler pid=%d" % pid
+		print("Start filler pid=%d" % pid)
 		time.sleep(sleep_sec)
 		return pid
 
 def start_pcopy_receiver(fname, fd):
-	print "Start receiver"
+	print("Start receiver")
 	t = libploop.ploopcopy_thr_receiver(fname, fd)
 	t.start()
 	return t
@@ -71,26 +71,26 @@ def dump_cbt(img):
 
 def do_ploop_copy(ddxml, fd):
 
-	print "do_ploop_copy"
+	print("do_ploop_copy")
 	ploop_mount(ddxml)
 	pc = libploop.ploopcopy(ddxml, fd);
 
 	pid = start_image_filller()
 
-	print "Start copy"
+	print("Start copy")
 	pc.copy_start()
 
 	for n in range(0, 10):
-		print "Iter:",  n
+		print("Iter:",  n)
 		transferred = pc.copy_next_iteration()
-		print "transferred:", transferred
+		print("transferred:", transferred)
 		time.sleep(sleep_sec)
 
-	print "Wait filler %d" % pid
+	print("Wait filler %d" % pid)
 	os.kill(pid, 15)
 	os.waitpid(pid, 0)
 
-	print "Stop copy"
+	print("Stop copy")
 	pc.copy_stop()
 	ploop_umount(ddxml)
 
@@ -114,13 +114,13 @@ class testPcopy(unittest.TestCase):
 		self.ddxml = get_ddxml()
 
 	def tearDown(self):
-		print "tearDown"
+		print("tearDown")
 		if os.path.exists(get_ddxml()):
 			ploop_umount(get_ddxml())
 			shutil.rmtree(get_storage())
 
 	def test_aremote(self):
-		print "Start remote"
+		print("Start remote")
 
 		parent, child = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
 
@@ -134,7 +134,7 @@ class testPcopy(unittest.TestCase):
 		self.assertEqual(src, dst)
 
 	def test_local(self):
-		print "Start local"
+		print("Start local")
 
 		f = open(self.out, 'wb')
 
@@ -146,7 +146,7 @@ class testPcopy(unittest.TestCase):
 		self.assertEqual(src, dst)
 
 	def test_local_cbt(self):
-		print "Start local CBT dst=%s" % self.out
+		print("Start local CBT dst=%s" % self.out)
 
 		sp.call(["ploop", "snapshot", "-u262178fe-49d7-4c8b-b47c-4c0799dbf02a", "-b262178fe-49d7-4c8b-b47c-4c0799dbf02a", self.ddxml])
 		sp.call(["ploop", "snapshot-delete", "-u262178fe-49d7-4c8b-b47c-4c0799dbf02a", self.ddxml])
diff --git a/tools/ploop-volume.c b/tools/ploop-volume.c
index 380f242..9e0e337 100644
--- a/tools/ploop-volume.c
+++ b/tools/ploop-volume.c
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <limits.h>
 
-#include <json/json.h>
+#include <json-c/json.h>
 
 #include "ploop.h"
 #include "libvolume.h"
@@ -238,6 +238,7 @@ static int snapshot(int argc, char **argv)
 
 	while ((i = getopt_long(argc, argv, "", opts, NULL)) != EOF) {
 		switch (i) {
+		case 1:
 			vol.i_path = optarg;
 			break;
 		default:
diff --git a/tools/ploop.c b/tools/ploop.c
index bd7ebc9..8ddf066 100644
--- a/tools/ploop.c
+++ b/tools/ploop.c
@@ -1192,7 +1192,7 @@ static int plooptool_list(int argc, char **argv)
 	char fname[PATH_MAX];
 	char image[PATH_MAX];
 	char mnt[PATH_MAX] = "";
-	char dev[64];
+	char dev[PATH_MAX];
 	DIR *dp;
 	struct dirent *de;
 	char cookie[PLOOP_COOKIE_SIZE];
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin