Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37568651
en ru br
ALT Linux repositórios
S:7.5.1-alt1
5.0: 3.1-alt1
4.1: 3.1-alt1
3.0:
+backports:3.1-alt0.M30.1

Group :: Ferramentas de texto
RPM: dos2unix

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: dos2unix-3.1-preserve-file-modes.patch
Download


--- dos2unix-3.1/dos2unix.c.mode	2003-05-21 08:09:08.000000000 -0700
+++ dos2unix-3.1/dos2unix.c	2003-05-21 08:09:56.000000000 -0700
@@ -345,11 +345,14 @@ int ConvertDosToUnixOldFile(char* ipInFN
   char TempPath[16];
   struct stat StatBuf;
   struct utimbuf UTimeBuf;
+  mode_t mode = S_IRUSR | S_IWUSR;
   int fd;
 
   /* retrieve ipInFN file date stamp */
-  if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
+  if (stat(ipInFN, &StatBuf))
     RetVal = -1;
+  else
+    mode = StatBuf.st_mode;
 
   strcpy (TempPath, "./u2dtmpXXXXXX");
   if((fd=mkstemp (TempPath))<0) {
@@ -357,6 +360,9 @@ int ConvertDosToUnixOldFile(char* ipInFN
 	  RetVal = -1;
   }
 
+  if (!RetVal && fchmod (fd, mode) && fchmod (fd, S_IRUSR | S_IWUSR))
+    RetVal = -1;
+
 #ifdef DEBUG
   fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath);
 #endif DEBUG
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009