Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sbin/gpt



On Nov 30,  4:58pm, John Nemeth wrote:
}
}      See question in gpt.c (and others).
} 
} On Nov 30,  2:59pm, "Christos Zoulas" wrote:
} }
} } This is a multi-part message in MIME format.
} } 
} } --_----------=_1448913574208280
} } Content-Disposition: inline
} } Content-Transfer-Encoding: 8bit
} } Content-Type: text/plain; charset="US-ASCII"
} } 
} } Module Name:	src
} } Committed By:	christos
} } Date:		Mon Nov 30 19:59:34 UTC 2015
} } 
} } Modified Files:
} } 	src/sbin/gpt: Makefile add.c gpt.8 gpt.c gpt.h resize.c
} } Added Files:
} } 	src/sbin/gpt: main.c
} } 
} } Log Message:
} } - automatically sync the wedge information unless -n is specified.
} } - document the general options in the traditional way.
} } - split the main program into a separate file.
} } 
} } 
} } To generate a diff of this commit:
} } cvs rdiff -u -r1.15 -r1.16 src/sbin/gpt/Makefile
} } cvs rdiff -u -r1.28 -r1.29 src/sbin/gpt/add.c
} } cvs rdiff -u -r1.37 -r1.38 src/sbin/gpt/gpt.8
} } cvs rdiff -u -r1.45 -r1.46 src/sbin/gpt/gpt.c
} } cvs rdiff -u -r1.21 -r1.22 src/sbin/gpt/gpt.h
} } cvs rdiff -u -r0 -r1.1 src/sbin/gpt/main.c
} } cvs rdiff -u -r1.12 -r1.13 src/sbin/gpt/resize.c
} } 
} } Please note that diffs are not public domain; they are subject to the
} } copyright notices on the relevant files.
} } 
} } 
} } --_----------=_1448913574208280
} } Content-Disposition: inline
} } Content-Length: 17047
} } Content-Transfer-Encoding: binary
} } Content-Type: text/x-diff; charset=us-ascii
} } 
} } Modified files:
} } 
} } Index: src/sbin/gpt/gpt.c
} } diff -u src/sbin/gpt/gpt.c:1.45 src/sbin/gpt/gpt.c:1.46
} } --- src/sbin/gpt/gpt.c:1.45	Sun Nov 29 09:03:35 2015
} } +++ src/sbin/gpt/gpt.c	Mon Nov 30 14:59:34 2015
} } @@ -35,7 +35,7 @@
} }  __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
} }  #endif
} }  #ifdef __RCSID
} } -__RCSID("$NetBSD: gpt.c,v 1.45 2015/11/29 14:03:35 christos Exp $");
} } +__RCSID("$NetBSD: gpt.c,v 1.46 2015/11/30 19:59:34 christos Exp $");
} }  #endif
} }  
} }  #include <sys/param.h>
} } @@ -68,7 +68,9 @@ off_t	mediasz;
} }  u_int	parts;
} }  u_int	secsz;
} }  
} } -int	readonly, verbose, quiet;
} } +int	readonly, verbose, quiet, nosync;
} } +
} } +static int modified;
} }  
} }  static uint32_t crc32_tab[] = {
} }  	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
} } @@ -269,10 +271,11 @@ gpt_write(int fd, map_t *map)
} }  
} }  	count = map->map_size * secsz;
} }  	ofs = map->map_start * secsz;
} } -	if (lseek(fd, ofs, SEEK_SET) == ofs &&
} } -	    write(fd, map->map_data, count) == (ssize_t)count)
} } -		return (0);
} } -	return (-1);
} } +	if (lseek(fd, ofs, SEEK_SET) != ofs ||
} 
}      Why did you change the "&&" to "||"?  If the lseek() fails,
} you will now be writing data to the wrong place on the disk.

     Never mind, I just looked at it again.  Of course, if the
lseek() fails, the whole expression is true, and short circuiting
rules apply.

} } +	    write(fd, map->map_data, count) != (ssize_t)count)
} } +		return -1;
} } +	modified = 1;
} } +	return 0;
} }  }
} }  
} }  static int
} } 
} } --_----------=_1448913574208280--
} } 
} }-- End of excerpt from "Christos Zoulas"
}-- End of excerpt from John Nemeth


Home | Main Index | Thread Index | Old Index