Deleted Added
full compact
file_io.c (213700) file_io.c (219001)
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file file_io.c
4/// \brief File opening, unlinking, and closing
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 443 unchanged lines hidden (view full) ---

452 goto error_msg;
453
454 if (S_ISDIR(pair->src_st.st_mode)) {
455 message_warning(_("%s: Is a directory, skipping"),
456 pair->src_name);
457 goto error;
458 }
459
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file file_io.c
4/// \brief File opening, unlinking, and closing
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 443 unchanged lines hidden (view full) ---

452 goto error_msg;
453
454 if (S_ISDIR(pair->src_st.st_mode)) {
455 message_warning(_("%s: Is a directory, skipping"),
456 pair->src_name);
457 goto error;
458 }
459
460 if (reg_files_only) {
461 if (!S_ISREG(pair->src_st.st_mode)) {
462 message_warning(_("%s: Not a regular file, "
463 "skipping"), pair->src_name);
464 goto error;
465 }
460 if (reg_files_only && !S_ISREG(pair->src_st.st_mode)) {
461 message_warning(_("%s: Not a regular file, skipping"),
462 pair->src_name);
463 goto error;
464 }
466
465
467 // These are meaningless on Windows.
468#ifndef TUKLIB_DOSLIKE
466#ifndef TUKLIB_DOSLIKE
467 if (reg_files_only && !opt_force) {
469 if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) {
470 // gzip rejects setuid and setgid files even
471 // when --force was used. bzip2 doesn't check
472 // for them, but calls fchown() after fchmod(),
473 // and many systems automatically drop setuid
474 // and setgid bits there.
475 //
476 // We accept setuid and setgid files if

--- 13 unchanged lines hidden (view full) ---

490 }
491
492 if (pair->src_st.st_nlink > 1) {
493 message_warning(_("%s: Input file has more "
494 "than one hard link, "
495 "skipping"), pair->src_name);
496 goto error;
497 }
468 if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) {
469 // gzip rejects setuid and setgid files even
470 // when --force was used. bzip2 doesn't check
471 // for them, but calls fchown() after fchmod(),
472 // and many systems automatically drop setuid
473 // and setgid bits there.
474 //
475 // We accept setuid and setgid files if

--- 13 unchanged lines hidden (view full) ---

489 }
490
491 if (pair->src_st.st_nlink > 1) {
492 message_warning(_("%s: Input file has more "
493 "than one hard link, "
494 "skipping"), pair->src_name);
495 goto error;
496 }
498#endif
499 }
497 }
498#endif
500
501 return false;
502
503error_msg:
504 message_error("%s: %s", pair->src_name, strerror(errno));
505error:
506 (void)close(pair->src_fd);
507 return true;

--- 451 unchanged lines hidden ---
499
500 return false;
501
502error_msg:
503 message_error("%s: %s", pair->src_name, strerror(errno));
504error:
505 (void)close(pair->src_fd);
506 return true;

--- 451 unchanged lines hidden ---