]> git.pld-linux.org Git - packages/glibc.git/commitdiff
- nuke sprintf family, to be used with diet
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 17 Apr 2005 20:29:08 +0000 (20:29 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    glibc-LD-path.c -> 1.2

glibc-LD-path.c

index 24709031829a3744a3ee206f2da8107c2b7bf688..1bf09648ad012a3c9ba5df73c08c19a82fac1c66 100644 (file)
  */
 
 
-#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 +80,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 +95,3 @@ int i, rv = 0;
 
        exit(rv);
 }
-
This page took 0.067556 seconds and 4 git commands to generate.