LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kdm-kdmconf.diff of Package kdebase4-workspace (Project DISCONTINUED:openSUSE:11.2)

--- kdm/kfrontend/genkdmconf.c
+++ kdm/kfrontend/genkdmconf.c
@@ -1019,6 +1019,26 @@
 		doLinkFile( ce->value );
 }
 
+static void
+cleanupFile( const char *tname, int mode )
+{
+	char *nname;
+	File file, file2;
+	char bn[PATH_MAX + 4];
+
+	ASPrintf( &nname, "%s/%s", newdir, tname );
+	sprintf( bn, "%s.bak", nname );
+
+	if (readFile( &file, nname ) && readFile( &file2, bn )) {
+		if ((file.eof - file.buf == file2.eof - file2.buf) && !strncmp( file.buf, file2.buf, file.eof - file.buf )) {
+			unlink( nname );
+			rename( bn, nname );
+			chmod( nname, mode );
+		}
+	}
+	free( nname );
+}
+
 /* Create a new file in KDMCONF and fill it */
 static void
 writeFile( const char *tname, int mode, const char *cont )
@@ -1027,6 +1047,8 @@
 	fputs( cont, f );
 	fclose( f );
 	addedFile( tname );
+        if (!no_backup)
+		cleanupFile( tname + sizeof(KDMCONF), mode );
 }
 
 
@@ -3024,9 +3046,9 @@
 				memcmp( oldkde + olen - sizeof(SHR_CONF) + 1,
 						SHR_CONF, sizeof(SHR_CONF) ))
 			{
-				fprintf( stderr,
-				         "Warning: --old-kde does not end with " SHR_CONF ". "
-				         "Might wreak havoc.\n" );
+/*				fprintf( stderr,
+ *				         "Warning: --old-kde (%s) does not end with " SHR_CONF ". "
+ *				         "Might wreak havoc.\n", oldkde ); */
 				oldkdepfx = oldkde;
 			} else
 				ASPrintf( (char **)&oldkdepfx,
@@ -3138,6 +3160,8 @@
 	f = createFile( "kdmrc", kdmrcmode );
 	writeKdmrc( f );
 	fclose( f );
+        if (!no_backup)
+		cleanupFile( "kdmrc", kdmrcmode );
 
 	f = createFile( "README", 0644 );
 	fprintf( f,
@@ -3186,6 +3210,8 @@
 "\nTry 'genkdmconf --help' if you want to generate another configuration.\n"
 "\nYou may delete this README.\n" );
 	fclose( f );
+        if (!no_backup)
+		cleanupFile( "README", 0644 );
 
 	return 0;
 }