In article <201512010058.tb10wtzj029...@server.cornerstoneservice.ca>, John Nemeth <jnem...@cue.bc.ca> wrote: > See question in gpt.c (and others). > >} - printf("Partition %d added, use:\n", i + 1); >} - printf("\tdkctl %s addwedge <wedgename> %" PRIu64 " %" PRIu64 >} - " <type>\n", device_arg, map->map_start, map->map_size); >} - printf("to create a wedge for it\n"); >} + printf("Partition %d added on %s: ", i + 1, device_arg); >} + printf("%s %" PRIu64 " %" PRIu64 "\n", type, map->map_start, >} + map->map_size); > > This message needs to depend on the new -n flag, otherwise it >may give incorrect information.
I will add a message to clarify that thanks! >} @@ -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. Nope, I flipped the polarity of the tests too. > >} + write(fd, map->map_data, count) != (ssize_t)count) >} + return -1; >} + modified = 1; >} + return 0; christos