Hello community, here is the log from the commit of package hfsutils checked in at Tue Nov 6 00:21:49 CET 2007. -------- --- hfsutils/hfsutils.changes 2006-01-25 21:36:28.000000000 +0100 +++ /mounts/work_src_done/STABLE/hfsutils/hfsutils.changes 2007-11-05 14:48:11.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Nov 5 14:47:32 CET 2007 - olh@suse.de + +- open block devices with O_EXCL (238687) + +------------------------------------------------------------------- New: ---- hfsutils-exclusive-open.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hfsutils.spec ++++++ --- /var/tmp/diff_new_pack.w16752/_old 2007-11-06 00:17:39.000000000 +0100 +++ /var/tmp/diff_new_pack.w16752/_new 2007-11-06 00:17:39.000000000 +0100 @@ -1,39 +1,38 @@ # # spec file for package hfsutils (Version 3.2.6) # -# Copyright (c) 2004 SuSE Linux AG, Nuernberg, Germany. +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # -# Please submit bugfixes or comments via http://www.suse.de/feedback/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild -# usedforbuild aaa_base acl attr bash bind-utils bison bzip2 coreutils cpio cpp cvs cyrus-sasl db devs diffutils e2fsprogs file filesystem fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip info insserv kbd less libacl libattr libgcc libstdc++ libxcrypt m4 make man mktemp modutils ncurses ncurses-devel net-tools netcfg openldap2-client openssl pam pam-devel pam-modules patch permissions popt ps rcs readline sed sendmail shadow strace syslogd sysvinit tar texinfo timezone unzip util-linux vim zlib zlib-devel XFree86-devel XFree86-libs autoconf automake binutils cracklib expat fontconfig fontconfig-devel gcc gdbm gettext libtool perl rpm tcl tcl-devel tk tk-devel Name: hfsutils BuildRequires: tk-devel xorg-x11-devel -License: GPL +License: GPL v2 or later Group: System/Filesystems -Autoreqprov: on +AutoReqProv: on Version: 3.2.6 -Release: 931 -Summary: Tools used for the Macintosh's Hierarchical File System -URL: http://www.mars.org/home/rob/proj/hfs/ +Release: 1139 +Summary: Tools Used for the Macintosh's Hierarchical File System +Url: http://www.mars.org/home/rob/proj/hfs/ Source: hfsutils-%{version}.tar.bz2 Patch: hfsutils-%{version}.dif Patch1: hfsutils-%{version}-ia64.dif Patch2: hfsutils-%{version}-seek.dif Patch3: hfsutils-%{version}-conf.dif Patch4: hfsutils-%{version}-errno.dif +Patch5: hfsutils-exclusive-open.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description -HFS is the "Hierarchical File System" used on modern Macintosh -computers. With this package, you can read and write -Macintosh-formatted media such as floppy disks, CD-ROMs, and SCSI hard -disks on most UNIX platforms. You can also format raw media into an HFS -volume. +HFS is the Hierarchical File System used on modern Macintosh computers. +With this package, you can read and write Macintosh-formatted media, +such as floppy disks, CD-ROMs, and SCSI hard disks on most UNIX +platforms. You can also format raw media into an HFS volume. @@ -43,10 +42,10 @@ %package -n xhfsutil Version: 3.2.6 -Release: 921 +Release: 1129 Summary: Tcl/Tk Front-End for hfsutils Group: System/Filesystems -Autoreqprov: on +AutoReqProv: on Requires: hfsutils %description -n xhfsutil @@ -67,6 +66,7 @@ %patch2 %patch3 %patch4 +%patch5 -p1 %build %{suse_update_config -f} @@ -126,8 +126,9 @@ %doc %{_mandir}/man1/hfssh.1.gz %doc %{_mandir}/man1/hfs.1.gz %doc %{_mandir}/man1/xhfs.1.gz - -%changelog -n hfsutils +%changelog +* Mon Nov 05 2007 - olh@suse.de +- open block devices with O_EXCL (238687) * Wed Jan 25 2006 - mls@suse.de - converted neededforbuild to BuildRequires * Sat Jan 10 2004 - adrian@suse.de ++++++ hfsutils-exclusive-open.patch ++++++ --- libhfs/os/unix.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --- a/libhfs/os/unix.c +++ b/libhfs/os/unix.c @@ -47,6 +47,13 @@ int fstat(int, struct stat *); # include "libhfs.h" # include "os.h" +/* do not write to a block device if the partition is busy */ +static int path_is_blockdevice(const char *path) +{ + struct stat sb; + return (stat(path, &sb) == 0 && S_ISBLK(sb.st_mode)); +} + /* * NAME: os->open() * DESCRIPTION: open and lock a new descriptor from the given path and mode @@ -55,26 +62,29 @@ int os_open(void **priv, const char *pat { long int fd; struct flock lock; + int os_mode = 0; switch (mode) { case HFS_MODE_RDONLY: - mode = O_RDONLY; + os_mode |= O_RDONLY; break; case HFS_MODE_RDWR: + if (path_is_blockdevice(path)) + os_mode |= O_EXCL; default: - mode = O_RDWR; + os_mode |= O_RDWR; break; } - fd = open(path, mode); + fd = open(path, os_mode); if (fd == -1) ERROR(errno, "error opening medium"); /* lock descriptor against concurrent access */ - lock.l_type = (mode == O_RDONLY) ? F_RDLCK : F_WRLCK; + lock.l_type = (os_mode == O_RDONLY) ? F_RDLCK : F_WRLCK; lock.l_start = 0; lock.l_whence = SEEK_SET; lock.l_len = 0; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org