… | |
… | |
34 | #include <sys/stat.h> |
34 | #include <sys/stat.h> |
35 | #include <stdio.h> |
35 | #include <stdio.h> |
36 | #include <stdlib.h> |
36 | #include <stdlib.h> |
37 | #include <stdarg.h> |
37 | #include <stdarg.h> |
38 | #include <string.h> |
38 | #include <string.h> |
|
|
39 | #include <errno.h> |
39 | |
40 | |
40 | #ifdef HAVE_FCNTL_H |
41 | #ifdef HAVE_FCNTL_H |
41 | #include <fcntl.h> |
42 | #include <fcntl.h> |
42 | #endif |
43 | #endif |
43 | |
|
|
44 | #ifdef HAVE_UNISTD_H |
44 | #ifdef HAVE_UNISTD_H |
45 | #include <unistd.h> |
45 | #include <unistd.h> |
46 | #endif |
46 | #endif |
47 | |
47 | |
48 | #ifdef TIME_WITH_SYS_TIME |
48 | #ifdef TIME_WITH_SYS_TIME |
… | |
… | |
52 | # ifdef HAVE_SYS_TIME_H |
52 | # ifdef HAVE_SYS_TIME_H |
53 | # include <sys/time.h> |
53 | # include <sys/time.h> |
54 | # else |
54 | # else |
55 | # include <time.h> |
55 | # include <time.h> |
56 | # endif |
56 | # endif |
57 | #endif |
|
|
58 | |
|
|
59 | #ifdef HAVE_ERRNO_H |
|
|
60 | #include <errno.h> |
|
|
61 | #endif |
57 | #endif |
62 | |
58 | |
63 | /* to get open() in Windows */ |
59 | /* to get open() in Windows */ |
64 | #ifdef HAVE_IO_H |
60 | #ifdef HAVE_IO_H |
65 | #include <io.h> |
61 | #include <io.h> |
… | |
… | |
692 | partcount = &_count; |
688 | partcount = &_count; |
693 | |
689 | |
694 | *partcount = 0; |
690 | *partcount = 0; |
695 | |
691 | |
696 | if ((datei = fopen (filename, "rb")) == NULL) { |
692 | if ((datei = fopen (filename, "rb")) == NULL) { |
697 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
693 | UUMessage (UUMSG_ERROR, |
698 | uustring (S_NOT_OPEN_SOURCE), |
694 | uustring (S_NOT_OPEN_SOURCE), |
699 | filename, strerror (uu_errno = errno)); |
695 | filename, strerror (uu_errno = errno)); |
700 | return UURET_IOERR; |
696 | return UURET_IOERR; |
701 | } |
697 | } |
702 | UUSETBUF (datei, datei_buf, uu_rbuf); |
698 | UUSETBUF (datei, datei_buf, uu_rbuf); |
703 | FP_flockfile (datei); |
699 | FP_flockfile (datei); |
704 | |
700 | |
705 | if (fstat (fileno(datei), &finfo) == -1) { |
701 | if (fstat (fileno(datei), &finfo) == -1) { |
706 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
702 | UUMessage (UUMSG_ERROR, |
707 | uustring (S_NOT_STAT_FILE), |
703 | uustring (S_NOT_STAT_FILE), |
708 | filename, strerror (uu_errno = errno)); |
704 | filename, strerror (uu_errno = errno)); |
709 | fclose (datei); |
705 | fclose (datei); |
710 | UUCLRBUF (uu_rbuf, datei_buf); |
706 | UUCLRBUF (uu_rbuf, datei_buf); |
711 | return UURET_IOERR; |
707 | return UURET_IOERR; |
… | |
… | |
715 | * schedule for destruction |
711 | * schedule for destruction |
716 | */ |
712 | */ |
717 | |
713 | |
718 | if (delflag && fileid==NULL) { |
714 | if (delflag && fileid==NULL) { |
719 | if ((killem = (itbd *) malloc (sizeof (itbd))) == NULL) { |
715 | if ((killem = (itbd *) malloc (sizeof (itbd))) == NULL) { |
720 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
716 | UUMessage (UUMSG_WARNING, uustring (S_OUT_OF_MEMORY), sizeof (itbd)); |
721 | uustring (S_OUT_OF_MEMORY), sizeof (itbd)); |
|
|
722 | } |
717 | } |
723 | else if ((killem->fname = FP_strdup (filename)) == NULL) { |
718 | else if ((killem->fname = FP_strdup (filename)) == NULL) { |
724 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
719 | UUMessage (UUMSG_WARNING, uustring (S_OUT_OF_MEMORY), strlen(filename)+1); |
725 | uustring (S_OUT_OF_MEMORY), strlen(filename)+1); |
|
|
726 | FP_free (killem); |
720 | FP_free (killem); |
727 | } |
721 | } |
728 | else { |
722 | else { |
729 | killem->NEXT = ftodel; |
723 | killem->NEXT = ftodel; |
730 | ftodel = killem; |
724 | ftodel = killem; |
… | |
… | |
758 | |
752 | |
759 | if ((loaded = ScanPart (datei, fileid, &sr)) == NULL) { |
753 | if ((loaded = ScanPart (datei, fileid, &sr)) == NULL) { |
760 | if (sr != UURET_NODATA && sr != UURET_OK && sr != UURET_CONT) { |
754 | if (sr != UURET_NODATA && sr != UURET_OK && sr != UURET_CONT) { |
761 | UUkillfread (loaded); |
755 | UUkillfread (loaded); |
762 | if (sr != UURET_CANCEL) |
756 | if (sr != UURET_CANCEL) |
763 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
757 | UUMessage (UUMSG_ERROR, |
764 | uustring (S_READ_ERROR), filename, |
758 | uustring (S_READ_ERROR), filename, |
765 | strerror (uu_errno)); |
759 | strerror (uu_errno)); |
766 | |
760 | |
767 | if (uu_autocheck) UUCheckGlobalList (); |
761 | if (uu_autocheck) UUCheckGlobalList (); |
768 | progress.action = 0; |
762 | progress.action = 0; |
… | |
… | |
772 | } |
766 | } |
773 | continue; |
767 | continue; |
774 | } |
768 | } |
775 | |
769 | |
776 | if (ferror (datei)) { |
770 | if (ferror (datei)) { |
777 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
771 | UUMessage (UUMSG_ERROR, |
778 | uustring (S_READ_ERROR), filename, |
772 | uustring (S_READ_ERROR), filename, |
779 | strerror (uu_errno = errno)); |
773 | strerror (uu_errno = errno)); |
780 | if (uu_autocheck) UUCheckGlobalList (); |
774 | if (uu_autocheck) UUCheckGlobalList (); |
781 | progress.action = 0; |
775 | progress.action = 0; |
782 | fclose (datei); |
776 | fclose (datei); |
… | |
… | |
812 | if ((fload = UUPreProcessPart (loaded, &res)) == NULL) { |
806 | if ((fload = UUPreProcessPart (loaded, &res)) == NULL) { |
813 | /* |
807 | /* |
814 | * no useful data found |
808 | * no useful data found |
815 | */ |
809 | */ |
816 | if (res != UURET_NODATA) { |
810 | if (res != UURET_NODATA) { |
817 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
811 | UUMessage (UUMSG_ERROR, |
818 | uustring (S_READ_ERROR), filename, |
812 | uustring (S_READ_ERROR), filename, |
819 | (res==UURET_IOERR)?strerror(uu_errno):UUstrerror(res)); |
813 | (res==UURET_IOERR)?strerror(uu_errno):UUstrerror(res)); |
820 | } |
814 | } |
821 | UUkillfread (loaded); |
815 | UUkillfread (loaded); |
822 | if (uu_fast_scanning && sr != UURET_CONT) break; |
816 | if (uu_fast_scanning && sr != UURET_CONT) break; |
… | |
… | |
825 | |
819 | |
826 | if ((loaded->subject && *(loaded->subject)) || |
820 | if ((loaded->subject && *(loaded->subject)) || |
827 | (loaded->mimeid && *(loaded->mimeid)) || |
821 | (loaded->mimeid && *(loaded->mimeid)) || |
828 | (loaded->filename&& *(loaded->filename))|| |
822 | (loaded->filename&& *(loaded->filename))|| |
829 | (loaded->uudet)) { |
823 | (loaded->uudet)) { |
830 | UUMessage (uulib_id, __LINE__, UUMSG_MESSAGE, |
824 | UUMessage (UUMSG_MESSAGE, |
831 | uustring (S_LOADED_PART), |
825 | uustring (S_LOADED_PART), |
832 | filename, |
826 | filename, |
833 | (loaded->subject) ? loaded->subject : "", |
827 | (loaded->subject) ? loaded->subject : "", |
834 | (fload->subfname) ? fload->subfname : "", |
828 | (fload->subfname) ? fload->subfname : "", |
835 | (loaded->filename) ? loaded->filename : "", |
829 | (loaded->filename) ? loaded->filename : "", |
… | |
… | |
869 | if (uu_fast_scanning && sr != UURET_CONT) |
863 | if (uu_fast_scanning && sr != UURET_CONT) |
870 | break; |
864 | break; |
871 | } |
865 | } |
872 | |
866 | |
873 | if (ferror (datei)) { |
867 | if (ferror (datei)) { |
874 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
868 | UUMessage (UUMSG_ERROR, |
875 | uustring (S_READ_ERROR), filename, |
869 | uustring (S_READ_ERROR), filename, |
876 | strerror (uu_errno = errno)); |
870 | strerror (uu_errno = errno)); |
877 | if (uu_autocheck) UUCheckGlobalList (); |
871 | if (uu_autocheck) UUCheckGlobalList (); |
878 | progress.action = 0; |
872 | progress.action = 0; |
879 | fclose (datei); |
873 | fclose (datei); |
… | |
… | |
883 | |
877 | |
884 | fclose (datei); |
878 | fclose (datei); |
885 | UUCLRBUF (uu_rbuf, datei_buf); |
879 | UUCLRBUF (uu_rbuf, datei_buf); |
886 | |
880 | |
887 | if (!uu_fast_scanning && *partcount == 0) |
881 | if (!uu_fast_scanning && *partcount == 0) |
888 | UUMessage (uulib_id, __LINE__, UUMSG_NOTE, |
882 | UUMessage (UUMSG_NOTE, uustring (S_NO_DATA_FOUND), filename); |
889 | uustring (S_NO_DATA_FOUND), filename); |
|
|
890 | |
883 | |
891 | progress.action = 0; |
884 | progress.action = 0; |
892 | if (uu_autocheck) UUCheckGlobalList (); |
885 | if (uu_autocheck) UUCheckGlobalList (); |
893 | |
886 | |
894 | return UURET_OK; |
887 | return UURET_OK; |
… | |
… | |
923 | if ((res = UUDecode (thefile)) != UURET_OK) |
916 | if ((res = UUDecode (thefile)) != UURET_OK) |
924 | if (res != UURET_NOEND || !uu_desperate) |
917 | if (res != UURET_NOEND || !uu_desperate) |
925 | return res; |
918 | return res; |
926 | |
919 | |
927 | if (thefile->binfile == NULL) { |
920 | if (thefile->binfile == NULL) { |
928 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
921 | UUMessage (UUMSG_ERROR, uustring (S_NO_BIN_FILE)); |
929 | uustring (S_NO_BIN_FILE)); |
|
|
930 | return UURET_IOERR; |
922 | return UURET_IOERR; |
931 | } |
923 | } |
932 | |
924 | |
933 | if ((source = fopen (thefile->binfile, "rb")) == NULL) { |
925 | if ((source = fopen (thefile->binfile, "rb")) == NULL) { |
934 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
926 | UUMessage (UUMSG_ERROR, |
935 | uustring (S_NOT_OPEN_FILE), |
927 | uustring (S_NOT_OPEN_FILE), |
936 | thefile->binfile, strerror (uu_errno = errno)); |
928 | thefile->binfile, strerror (uu_errno = errno)); |
937 | return UURET_IOERR; |
929 | return UURET_IOERR; |
938 | } |
930 | } |
939 | UUSETBUF (source, source_buf, uu_rbuf); |
931 | UUSETBUF (source, source_buf, uu_rbuf); |
… | |
… | |
942 | /* |
934 | /* |
943 | * for system security, strip setuid/setgid bits from mode |
935 | * for system security, strip setuid/setgid bits from mode |
944 | */ |
936 | */ |
945 | |
937 | |
946 | if ((thefile->mode & 0777) != thefile->mode) { |
938 | if ((thefile->mode & 0777) != thefile->mode) { |
947 | UUMessage (uulib_id, __LINE__, UUMSG_NOTE, |
939 | UUMessage (UUMSG_NOTE, |
948 | uustring (S_STRIPPED_SETUID), |
940 | uustring (S_STRIPPED_SETUID), |
949 | destname, (int)thefile->mode); |
941 | destname, (int)thefile->mode); |
950 | thefile->mode &= 0777; |
942 | thefile->mode &= 0777; |
951 | } |
943 | } |
952 | |
944 | |
… | |
… | |
974 | * if we don't want to overwrite existing files, check if it's there |
966 | * if we don't want to overwrite existing files, check if it's there |
975 | */ |
967 | */ |
976 | |
968 | |
977 | if (!uu_overwrite) { |
969 | if (!uu_overwrite) { |
978 | if (stat (uugen_fnbuffer, &finfo) == 0) { |
970 | if (stat (uugen_fnbuffer, &finfo) == 0) { |
979 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
971 | UUMessage (UUMSG_ERROR, uustring (S_TARGET_EXISTS), uugen_fnbuffer); |
980 | uustring (S_TARGET_EXISTS), uugen_fnbuffer); |
|
|
981 | fclose (source); |
972 | fclose (source); |
982 | UUCLRBUF (uu_rbuf, source_buf); |
973 | UUCLRBUF (uu_rbuf, source_buf); |
983 | return UURET_EXISTS; |
974 | return UURET_EXISTS; |
984 | } |
975 | } |
985 | } |
976 | } |
986 | |
977 | |
987 | if (fstat (fileno(source), &finfo) == -1) { |
978 | if (fstat (fileno(source), &finfo) == -1) { |
988 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
979 | UUMessage (UUMSG_ERROR, |
989 | uustring (S_NOT_STAT_FILE), |
980 | uustring (S_NOT_STAT_FILE), |
990 | thefile->binfile, strerror (uu_errno = errno)); |
981 | thefile->binfile, strerror (uu_errno = errno)); |
991 | fclose (source); |
982 | fclose (source); |
992 | UUCLRBUF (uu_rbuf, source_buf); |
983 | UUCLRBUF (uu_rbuf, source_buf); |
993 | return UURET_IOERR; |
984 | return UURET_IOERR; |
… | |
… | |
1022 | |
1013 | |
1023 | if ((fildes = open (uugen_fnbuffer, |
1014 | if ((fildes = open (uugen_fnbuffer, |
1024 | O_WRONLY | O_CREAT | O_BINARY | O_TRUNC, |
1015 | O_WRONLY | O_CREAT | O_BINARY | O_TRUNC, |
1025 | (uu_ignmode)?0666:thefile->mode)) == -1) { |
1016 | (uu_ignmode)?0666:thefile->mode)) == -1) { |
1026 | progress.action = 0; |
1017 | progress.action = 0; |
1027 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1018 | UUMessage (UUMSG_ERROR, |
1028 | uustring (S_NOT_OPEN_TARGET), |
1019 | uustring (S_NOT_OPEN_TARGET), |
1029 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1020 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1030 | fclose (source); |
1021 | fclose (source); |
1031 | UUCLRBUF (uu_rbuf, source_buf); |
1022 | UUCLRBUF (uu_rbuf, source_buf); |
1032 | return UURET_IOERR; |
1023 | return UURET_IOERR; |
1033 | } |
1024 | } |
1034 | |
1025 | |
1035 | if ((target = fdopen (fildes, "wb")) == NULL) { |
1026 | if ((target = fdopen (fildes, "wb")) == NULL) { |
1036 | progress.action = 0; |
1027 | progress.action = 0; |
1037 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1028 | UUMessage (UUMSG_ERROR, |
1038 | uustring (S_IO_ERR_TARGET), |
1029 | uustring (S_IO_ERR_TARGET), |
1039 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1030 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1040 | fclose (source); |
1031 | fclose (source); |
1041 | UUCLRBUF (uu_rbuf, source_buf); |
1032 | UUCLRBUF (uu_rbuf, source_buf); |
1042 | close (fildes); |
1033 | close (fildes); |
… | |
… | |
1046 | FP_flockfile (target); |
1037 | FP_flockfile (target); |
1047 | |
1038 | |
1048 | while (!FP_feof (source)) { |
1039 | while (!FP_feof (source)) { |
1049 | |
1040 | |
1050 | if (UUBUSYPOLL(ftell(source),progress.fsize)) { |
1041 | if (UUBUSYPOLL(ftell(source),progress.fsize)) { |
1051 | UUMessage (uulib_id, __LINE__, UUMSG_NOTE, |
1042 | UUMessage (UUMSG_NOTE, uustring (S_DECODE_CANCEL)); |
1052 | uustring (S_DECODE_CANCEL)); |
|
|
1053 | fclose (source); |
1043 | fclose (source); |
1054 | UUCLRBUF (uu_rbuf, source_buf); |
1044 | UUCLRBUF (uu_rbuf, source_buf); |
1055 | fclose (target); |
1045 | fclose (target); |
1056 | UUCLRBUF (uu_wbuf, target_buf); |
1046 | UUCLRBUF (uu_wbuf, target_buf); |
1057 | unlink (uugen_fnbuffer); |
1047 | unlink (uugen_fnbuffer); |
… | |
… | |
1060 | |
1050 | |
1061 | bytes = fread (uugen_inbuffer, 1, 1024, source); |
1051 | bytes = fread (uugen_inbuffer, 1, 1024, source); |
1062 | |
1052 | |
1063 | if (ferror (source) || (bytes == 0 && !FP_feof (source))) { |
1053 | if (ferror (source) || (bytes == 0 && !FP_feof (source))) { |
1064 | progress.action = 0; |
1054 | progress.action = 0; |
1065 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1055 | UUMessage (UUMSG_ERROR, |
1066 | uustring (S_READ_ERROR), |
1056 | uustring (S_READ_ERROR), |
1067 | thefile->binfile, strerror (uu_errno = errno)); |
1057 | thefile->binfile, strerror (uu_errno = errno)); |
1068 | fclose (source); |
1058 | fclose (source); |
1069 | UUCLRBUF (uu_rbuf, source_buf); |
1059 | UUCLRBUF (uu_rbuf, source_buf); |
1070 | fclose (target); |
1060 | fclose (target); |
… | |
… | |
1072 | unlink (uugen_fnbuffer); |
1062 | unlink (uugen_fnbuffer); |
1073 | return UURET_IOERR; |
1063 | return UURET_IOERR; |
1074 | } |
1064 | } |
1075 | if (fwrite (uugen_inbuffer, 1, bytes, target) != bytes) { |
1065 | if (fwrite (uugen_inbuffer, 1, bytes, target) != bytes) { |
1076 | progress.action = 0; |
1066 | progress.action = 0; |
1077 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1067 | UUMessage (UUMSG_ERROR, |
1078 | uustring (S_WR_ERR_TARGET), |
1068 | uustring (S_WR_ERR_TARGET), |
1079 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1069 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1080 | fclose (source); |
1070 | fclose (source); |
1081 | UUCLRBUF (uu_rbuf, source_buf); |
1071 | UUCLRBUF (uu_rbuf, source_buf); |
1082 | fclose (target); |
1072 | fclose (target); |
… | |
… | |
1088 | |
1078 | |
1089 | fclose (source); |
1079 | fclose (source); |
1090 | UUCLRBUF (uu_rbuf, source_buf); |
1080 | UUCLRBUF (uu_rbuf, source_buf); |
1091 | if (fclose (target)) { |
1081 | if (fclose (target)) { |
1092 | UUCLRBUF (uu_wbuf, target_buf); |
1082 | UUCLRBUF (uu_wbuf, target_buf); |
1093 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1083 | UUMessage (UUMSG_ERROR, |
1094 | uustring (S_WR_ERR_TARGET), |
1084 | uustring (S_WR_ERR_TARGET), |
1095 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1085 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1096 | unlink (uugen_fnbuffer); |
1086 | unlink (uugen_fnbuffer); |
1097 | return UURET_IOERR; |
1087 | return UURET_IOERR; |
1098 | } |
1088 | } |
… | |
… | |
1101 | /* |
1091 | /* |
1102 | * after a successful decoding run, we delete the temporary file |
1092 | * after a successful decoding run, we delete the temporary file |
1103 | */ |
1093 | */ |
1104 | |
1094 | |
1105 | if (unlink (thefile->binfile)) { |
1095 | if (unlink (thefile->binfile)) { |
1106 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
1096 | UUMessage (UUMSG_WARNING, |
1107 | uustring (S_TMP_NOT_REMOVED), |
1097 | uustring (S_TMP_NOT_REMOVED), |
1108 | thefile->binfile, |
1098 | thefile->binfile, |
1109 | strerror (uu_errno = errno)); |
1099 | strerror (uu_errno = errno)); |
1110 | } |
1100 | } |
1111 | |
1101 | |
… | |
… | |
1143 | 1)) != UURET_OK) |
1133 | 1)) != UURET_OK) |
1144 | return res; |
1134 | return res; |
1145 | if ((inpfile = fopen (uugen_fnbuffer, "rb")) == NULL) { |
1135 | if ((inpfile = fopen (uugen_fnbuffer, "rb")) == NULL) { |
1146 | (*uu_FileCallback) (uu_FileCBArg, thefile->thisfile->data->sfname, |
1136 | (*uu_FileCallback) (uu_FileCBArg, thefile->thisfile->data->sfname, |
1147 | uugen_fnbuffer, 0); |
1137 | uugen_fnbuffer, 0); |
1148 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1138 | UUMessage (UUMSG_ERROR, |
1149 | uustring (S_NOT_OPEN_FILE), uugen_fnbuffer, |
1139 | uustring (S_NOT_OPEN_FILE), uugen_fnbuffer, |
1150 | strerror (uu_errno = errno)); |
1140 | strerror (uu_errno = errno)); |
1151 | return UURET_IOERR; |
1141 | return UURET_IOERR; |
1152 | } |
1142 | } |
1153 | } |
1143 | } |
1154 | else { |
1144 | else { |
1155 | if ((inpfile = fopen (thefile->thisfile->data->sfname, "rb")) == NULL) { |
1145 | if ((inpfile = fopen (thefile->thisfile->data->sfname, "rb")) == NULL) { |
1156 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1146 | UUMessage (UUMSG_ERROR, |
1157 | uustring (S_NOT_OPEN_FILE), |
1147 | uustring (S_NOT_OPEN_FILE), |
1158 | thefile->thisfile->data->sfname, |
1148 | thefile->thisfile->data->sfname, |
1159 | strerror (uu_errno=errno)); |
1149 | strerror (uu_errno=errno)); |
1160 | return UURET_IOERR; |
1150 | return UURET_IOERR; |
1161 | } |
1151 | } |
… | |
… | |
1194 | if ((*func) (opaque, uugen_inbuffer)) |
1184 | if ((*func) (opaque, uugen_inbuffer)) |
1195 | break; |
1185 | break; |
1196 | } |
1186 | } |
1197 | |
1187 | |
1198 | if (ferror (inpfile)) { |
1188 | if (ferror (inpfile)) { |
1199 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1189 | UUMessage (UUMSG_ERROR, |
1200 | uustring (S_READ_ERROR), |
1190 | uustring (S_READ_ERROR), |
1201 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1191 | uugen_fnbuffer, strerror (uu_errno = errno)); |
1202 | errflag = 1; |
1192 | errflag = 1; |
1203 | } |
1193 | } |
1204 | |
1194 | |
… | |
… | |
1224 | return UURET_ILLVAL; |
1214 | return UURET_ILLVAL; |
1225 | |
1215 | |
1226 | oldname = thefile->filename; |
1216 | oldname = thefile->filename; |
1227 | |
1217 | |
1228 | if ((thefile->filename = FP_strdup (newname)) == NULL) { |
1218 | if ((thefile->filename = FP_strdup (newname)) == NULL) { |
1229 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1219 | UUMessage (UUMSG_ERROR, uustring (S_NOT_RENAME), oldname, newname); |
1230 | uustring (S_NOT_RENAME), |
|
|
1231 | oldname, newname); |
|
|
1232 | thefile->filename = oldname; |
1220 | thefile->filename = oldname; |
1233 | return UURET_NOMEM; |
1221 | return UURET_NOMEM; |
1234 | } |
1222 | } |
1235 | FP_free (oldname); |
1223 | FP_free (oldname); |
1236 | return UURET_OK; |
1224 | return UURET_OK; |
… | |
… | |
1242 | if (thefile == NULL) |
1230 | if (thefile == NULL) |
1243 | return UURET_ILLVAL; |
1231 | return UURET_ILLVAL; |
1244 | |
1232 | |
1245 | if (thefile->binfile) { |
1233 | if (thefile->binfile) { |
1246 | if (unlink (thefile->binfile)) { |
1234 | if (unlink (thefile->binfile)) { |
1247 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
1235 | UUMessage (UUMSG_WARNING, |
1248 | uustring (S_TMP_NOT_REMOVED), |
1236 | uustring (S_TMP_NOT_REMOVED), |
1249 | thefile->binfile, |
1237 | thefile->binfile, |
1250 | strerror (uu_errno = errno)); |
1238 | strerror (uu_errno = errno)); |
1251 | } |
1239 | } |
1252 | FP_free (thefile->binfile); |
1240 | FP_free (thefile->binfile); |
… | |
… | |
1268 | * delete temporary input files (such as the copy of stdin) |
1256 | * delete temporary input files (such as the copy of stdin) |
1269 | */ |
1257 | */ |
1270 | |
1258 | |
1271 | while (iter) { |
1259 | while (iter) { |
1272 | if (unlink (iter->fname)) { |
1260 | if (unlink (iter->fname)) { |
1273 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
1261 | UUMessage (UUMSG_WARNING, |
1274 | uustring (S_TMP_NOT_REMOVED), |
1262 | uustring (S_TMP_NOT_REMOVED), |
1275 | iter->fname, strerror (uu_errno = errno)); |
1263 | iter->fname, strerror (uu_errno = errno)); |
1276 | } |
1264 | } |
1277 | FP_free (iter->fname); |
1265 | FP_free (iter->fname); |
1278 | ptr = iter; |
1266 | ptr = iter; |