]> git.pld-linux.org Git - packages/glibc.git/blobdiff - glibc-LD-path.c
- explicit ldconfig conflicts for glibc-ld
[packages/glibc.git] / glibc-LD-path.c
index 24709031829a3744a3ee206f2da8107c2b7bf688..ec1e0020c7bf8989cc11b45fe33ad0fa0f8001bb 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
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *       This product includes software developed by Elan Ruusamäe
+ *       This product includes software developed by Elan Ruusamäe
  * 4. Neither the name of the author nor the names of any co-contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY ELAN RUUSAMÄE AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY ELAN RUUSAMÄE AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * 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
+ * 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.092019 seconds and 4 git commands to generate.