Sun Jan 17 22:47:19 2010 UTC ()
Close file when finished with it. Found by cppcheck.


(wiz)
diff -r1.56 -r1.57 src/distrib/utils/sysinst/arch/mac68k/md.c

cvs diff -r1.56 -r1.57 src/distrib/utils/sysinst/arch/mac68k/Attic/md.c (expand / switch to unified diff)

--- src/distrib/utils/sysinst/arch/mac68k/Attic/md.c 2010/01/02 18:06:58 1.56
+++ src/distrib/utils/sysinst/arch/mac68k/Attic/md.c 2010/01/17 22:47:18 1.57
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.56 2010/01/02 18:06:58 dsl Exp $ */ 1/* $NetBSD: md.c,v 1.57 2010/01/17 22:47:18 wiz Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -767,26 +767,27 @@ getName(part, len_name, name) @@ -767,26 +767,27 @@ getName(part, len_name, name)
767 /* 767 /*
768 * Open the disk as a raw device 768 * Open the disk as a raw device
769 */ 769 */
770 if ((fd = open(dev_name, O_RDONLY, 0)) >= 0) { 770 if ((fd = open(dev_name, O_RDONLY, 0)) >= 0) {
771 seek = (off_t)part->pmPyPartStart + (off_t)2; 771 seek = (off_t)part->pmPyPartStart + (off_t)2;
772 seek *= (off_t)blk_size; 772 seek *= (off_t)blk_size;
773 lseek(fd, seek, SEEK_SET); 773 lseek(fd, seek, SEEK_SET);
774 read(fd, &macosblk, sizeof(macosblk)); 774 read(fd, &macosblk, sizeof(macosblk));
775 macosblk[37+32] = '\0'; 775 macosblk[37+32] = '\0';
776 strncpy(name, (char *)bzb->mount_point, len_name); 776 strncpy(name, (char *)bzb->mount_point, len_name);
777 strncat(name, " (", len_name-strlen(name)); 777 strncat(name, " (", len_name-strlen(name));
778 strncat(name, &macosblk[37], len_name-strlen(name)); 778 strncat(name, &macosblk[37], len_name-strlen(name));
779 strncat(name, ")", len_name-strlen(name)); 779 strncat(name, ")", len_name-strlen(name));
 780 close(fd);
780 } 781 }
781 break; 782 break;
782 default: 783 default:
783 break; 784 break;
784 } 785 }
785 return(name); 786 return(name);
786} 787}
787 788
788/* 789/*
789 * Find the first occurance of a Standard Type partition and 790 * Find the first occurance of a Standard Type partition and
790 * mark it for use along with the default mount slot. 791 * mark it for use along with the default mount slot.
791 */ 792 */
792static int 793static int