]> git.pld-linux.org Git - packages/glibc.git/blobdiff - glibc-LD-path.c
- add binutils patch (quick and dirty)
[packages/glibc.git] / glibc-LD-path.c
index 24709031829a3744a3ee206f2da8107c2b7bf688..83a661f4796beb38bff3184ba4c2995c1d3e2759 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004 Elan Ruusamäe <glen@pld-linux.org>.
+ * Copyright (c) 2004, 2005 Elan Ruusamäe <glen@pld-linux.org>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * For example, in glibc.spec:
  *
  * %post -p /sbin/postshell
- * /sbin/glibc-postrm /%{_lib}/i686
+ * /sbin/glibc-postinst /%{_lib}/%{_host_cpu}
+ * /sbin/ldconfig /%{_lib} %{_prefix}/%{_lib}
  *
  * Patches and bugreports are welcome, direct them to Elan Ruusamäe
  * <glen@pld-linux.org>.
  */
 
 
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <limits.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 
+#define error(msg) write(2, msg, strlen(msg))
+#define warn(msg) write(2, msg, strlen(msg))
+
 int main (int argc, char *argv[])
 {
 struct stat st;
 int i, rv = 0;
 
        if (argc == 1) {
-               fprintf(stderr, "This program is intended to be used by glibc postinstall stage.\n");
+               error("This program is intended to be used by glibc postinstall stage.\n");
                exit(1);
        }
 
@@ -79,10 +81,12 @@ int i, rv = 0;
                }
 
                if (S_ISDIR(st.st_mode)) {
-                       char p[strlen(path) + sizeof(".rpmsave") + 1];
+                       int l = strlen(path);
+                       char p[l + sizeof(".rpmsave") + 1];
 
-                       sprintf(p, "%s.rpmsave", path);
-                       fprintf(stderr, "Renaming %s to %s\n", path, p);
+                       strcpy(p, path);
+                       strcpy(p + l, ".rpmsave");
+                       warn("Renaming "); warn(path); warn(" to "); warn(p); warn("\n");
                        if (rename(path, p) == -1) {
                                perror("rename");
                                rv = 1;
@@ -92,4 +96,3 @@ int i, rv = 0;
 
        exit(rv);
 }
-
This page took 0.026423 seconds and 4 git commands to generate.