… | |
… | |
79 | #include <uudeview.h> |
79 | #include <uudeview.h> |
80 | #include <uuint.h> |
80 | #include <uuint.h> |
81 | #include <fptools.h> |
81 | #include <fptools.h> |
82 | #include <uustring.h> |
82 | #include <uustring.h> |
83 | |
83 | |
84 | char * uulib_id = "$Id: uulib.c,v 1.2 2001/06/11 20:42:37 root Exp $"; |
84 | char * uulib_id = "$Id: uulib.c,v 1.3 2001/06/12 03:20:45 root Exp $"; |
85 | |
85 | |
86 | #ifdef SYSTEM_WINDLL |
86 | #ifdef SYSTEM_WINDLL |
87 | BOOL _export WINAPI |
87 | BOOL _export WINAPI |
88 | DllEntryPoint (HINSTANCE hInstance, DWORD seginfo, |
88 | DllEntryPoint (HINSTANCE hInstance, DWORD seginfo, |
89 | LPVOID lpCmdLine) |
89 | LPVOID lpCmdLine) |
… | |
… | |
939 | thefile->binfile, strerror (uu_errno = errno)); |
939 | thefile->binfile, strerror (uu_errno = errno)); |
940 | fclose (source); |
940 | fclose (source); |
941 | return UURET_IOERR; |
941 | return UURET_IOERR; |
942 | } |
942 | } |
943 | |
943 | |
|
|
944 | /* try rename() shortcut first */ |
|
|
945 | if (!rename (thefile->binfile, uugen_fnbuffer)) |
|
|
946 | { |
|
|
947 | mode_t mask = 0000; /* there is a slight window here anyway */ |
|
|
948 | #if HAVE_UMASK |
|
|
949 | mask = umask (0022); umask (mask); |
|
|
950 | #endif |
|
|
951 | #if HAVE_CHMOD |
|
|
952 | chmod (uugen_fnbuffer, thefile->mode & ~mask); |
|
|
953 | #endif |
|
|
954 | goto skip_copy; |
|
|
955 | } |
|
|
956 | |
944 | progress.action = 0; |
957 | progress.action = 0; |
945 | FP_strncpy (progress.curfile, |
958 | FP_strncpy (progress.curfile, |
946 | (strlen(uugen_fnbuffer)>255)? |
959 | (strlen(uugen_fnbuffer)>255)? |
947 | (uugen_fnbuffer+strlen(uugen_fnbuffer)-255):uugen_fnbuffer, |
960 | (uugen_fnbuffer+strlen(uugen_fnbuffer)-255):uugen_fnbuffer, |
948 | 256); |
961 | 256); |
… | |
… | |
1020 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
1033 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
1021 | uustring (S_TMP_NOT_REMOVED), |
1034 | uustring (S_TMP_NOT_REMOVED), |
1022 | thefile->binfile, |
1035 | thefile->binfile, |
1023 | strerror (uu_errno = errno)); |
1036 | strerror (uu_errno = errno)); |
1024 | } |
1037 | } |
|
|
1038 | |
|
|
1039 | skip_copy: |
1025 | FP_free (thefile->binfile); |
1040 | FP_free (thefile->binfile); |
1026 | thefile->binfile = NULL; |
1041 | thefile->binfile = NULL; |
1027 | thefile->state &= ~UUFILE_TMPFILE; |
1042 | thefile->state &= ~UUFILE_TMPFILE; |
1028 | thefile->state |= UUFILE_DECODED; |
1043 | thefile->state |= UUFILE_DECODED; |
1029 | progress.action = 0; |
1044 | progress.action = 0; |