Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
s390-tools.8462
s390-tools-sles15-Fixup-dasdfmt_get_volser.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File s390-tools-sles15-Fixup-dasdfmt_get_volser.patch of Package s390-tools.8462
From f3adc9ca7928a8250f31b242335686ad9879ce10 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Thu, 5 Oct 2017 09:42:42 +0200 Subject: [PATCH] dasdfmt: Fixup dasdfmt_get_volser() dasdfmt_get_volser() opens its own private filedescriptor despite the global filedes already being opened. And we should be passing in only the bits of the info structure that we actually need. Signed-off-by: Hannes Reinecke <hare@suse.com> --- dasdfmt/dasdfmt.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c index 6043872..4cf423d 100644 --- a/dasdfmt/dasdfmt.c +++ b/dasdfmt/dasdfmt.c @@ -970,28 +970,19 @@ static void dasdfmt_print_info(dasdfmt_info_t *info, volume_label_t *vlabel, /* * get volser */ -static int dasdfmt_get_volser(dasdfmt_info_t *info, char *volser) +static int dasdfmt_get_volser(char *devname, dasd_information2_t *dasd_info, + char *volser) { unsigned int blksize; - int f; volume_label_t vlabel; - f = open(info->devname, O_RDONLY); - if (f == -1) - ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n", - prog_name, info->devname, strerror(errno)); - get_blocksize(&blksize); - if (close(f) != 0) - ERRMSG("%s: error during close: %s\ncontinuing...\n", - prog_name, strerror(errno)); - - if ((strncmp(info->dasd_info.type, "ECKD", 4) == 0) && - (!info->dasd_info.FBA_layout)) { + if ((strncmp(dasd_info->type, "ECKD", 4) == 0) && + !dasd_info->FBA_layout) { /* OS/390 and zOS compatible disk layout */ - vtoc_read_volume_label(info->devname, - info->dasd_info.label_block * blksize, + vtoc_read_volume_label(devname, + dasd_info->label_block * blksize, &vlabel); vtoc_volume_label_get_volser(&vlabel, volser); return 0; @@ -1684,7 +1675,8 @@ int main(int argc, char *argv[]) exit(1); } - if (dasdfmt_get_volser(&info, old_volser) == 0) + if (dasdfmt_get_volser(info.devname, + &info.dasd_info, old_volser) == 0) vtoc_volume_label_set_volser(&vlabel, old_volser); else ERRMSG_EXIT(EXIT_FAILURE, -- 1.7.12.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor