patch-fdisk_sfdisk_c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
  2. --- util-linux-2.12r.orig/fdisk/sfdisk.c 2005-01-04 23:31:57.000000000 +0100
  3. +++ util-linux-2.12r/fdisk/sfdisk.c 2008-10-16 12:42:16.000000000 +0200
  4. @@ -171,16 +171,6 @@ fatal(char *s, ...) {
  5. *
  6. * Note: we use 512-byte sectors here, irrespective of the hardware ss.
  7. */
  8. -#undef use_lseek
  9. -#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
  10. -#define use_lseek
  11. -#endif
  12. -
  13. -#ifndef use_lseek
  14. -static __attribute__used
  15. -_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
  16. - loff_t *, res, unsigned int, wh);
  17. -#endif
  18. static int
  19. sseek(char *dev, unsigned int fd, unsigned long s) {
  20. @@ -188,12 +178,8 @@ sseek(char *dev, unsigned int fd, unsign
  21. in = ((loff_t) s << 9);
  22. out = 1;
  23. -#ifndef use_lseek
  24. - if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
  25. -#else
  26. - if ((out = lseek(fd, in, SEEK_SET)) != in) {
  27. -#endif
  28. - perror("llseek");
  29. + if ((out = lseek64(fd, in, SEEK_SET)) != in) {
  30. + perror("lseek64");
  31. error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
  32. return 0;
  33. }
  34. @@ -1730,12 +1716,12 @@ read_stdin(unsigned char **fields, unsig
  35. eof = 1;
  36. return RD_EOF;
  37. }
  38. - if (!(lp = index(lp, '\n')))
  39. + if (!(lp = strchr(lp, '\n')))
  40. fatal(_("long or incomplete input line - quitting\n"));
  41. *lp = 0;
  42. /* remove comments, if any */
  43. - if ((lp = index(line+2, '#')) != 0)
  44. + if ((lp = strchr(line+2, '#')) != 0)
  45. *lp = 0;
  46. /* recognize a few commands - to be expanded */
  47. @@ -1745,7 +1731,7 @@ read_stdin(unsigned char **fields, unsig
  48. }
  49. /* dump style? - then bad input is fatal */
  50. - if ((ip = index(line+2, ':')) != 0) {
  51. + if ((ip = strchr(line+2, ':')) != 0) {
  52. struct dumpfld *d;
  53. nxtfld:
  54. @@ -2514,7 +2500,7 @@ main(int argc, char **argv) {
  55. if (argc < 1)
  56. fatal(_("no command?\n"));
  57. - if ((progn = rindex(argv[0], '/')) == NULL)
  58. + if ((progn = strrchr(argv[0], '/')) == NULL)
  59. progn = argv[0];
  60. else
  61. progn++;