Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37812592
en ru br
ALT Linux repositórios
S:2.38.0.23.0e1ef6779a-alt1
5.0: 2.9-alt5
4.1: 2.5.1-alt4.M41.2
4.0: 2.5-alt4.M40.2
3.0: 2.3.5-alt5

Outros repositórios

Group :: Sistema/Base
RPM: glibc

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

glibc-helpers-2.5-alt4.M40.2/000075500000000000000000000000001165154043600154445ustar00rootroot00000000000000glibc-helpers-2.5-alt4.M40.2/Makefile000064400000000000000000000012641165154043600171070ustar00rootroot00000000000000INSTALL = install
CFLAGS = $(RPM_OPT_FLAGS)
SRC = glibc_fix_nsswitch.c glibc_post_upgrade.c linkify.c post_ldconfig.c postun_ldconfig.c glibc_preinstall.c
C_TARGETS = $(SRC:.c=)
I_TARGETS = glibc_fix_nsswitch glibc_fix_nsswitch.sh glibc_post_upgrade post_ldconfig postun_ldconfig glibc_preinstall
enablekernel =

.PHONY: all install clean

all: $(C_TARGETS)

install: $(I_TARGETS)
for f in $^; do \
$(INSTALL) -pD -m700 $$f $(RPM_BUILD_ROOT)/sbin/$$f; \
done

clean:
$(RM) $(C_TARGETS) *~

glibc_preinstall: glibc_preinstall.c
gcc '-DMIN_KERNEL_VERSION="$(enablekernel)"' -Wall -W \
-Os --static -fno-stack-protector -nostartfiles -nostdlib \
glibc_preinstall.c -o glibc_preinstall
glibc-helpers-2.5-alt4.M40.2/glibc_fix_nsswitch.c000064400000000000000000000003101165154043600214520ustar00rootroot00000000000000#include <unistd.h>

int
main (void)
{
const char *args[] = { "glibc_fix_nsswitch", 0 };
const char *pathname = "/sbin/glibc_fix_nsswitch.sh";

execv (pathname, (char *const *) args);
return 0;
}
glibc-helpers-2.5-alt4.M40.2/glibc_fix_nsswitch.sh000064400000000000000000000002721165154043600216510ustar00rootroot00000000000000#!/bin/sh

f=/etc/nsswitch.conf
if [ ! -f "$f" ]; then
if [ -f "$f".rpmsave ]; then
/bin/cp -pf "$f".rpmsave "$f"
elif [ -f "$f".rpmnew ]; then
/bin/cp -pf "$f".rpmnew "$f"
fi
fi
glibc-helpers-2.5-alt4.M40.2/glibc_post_upgrade.c000064400000000000000000000021611165154043600214440ustar00rootroot00000000000000#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>

static int
exec_wait (const char *path, const char *av[])
{
pid_t pid = vfork ();

if (pid < 0)
return 1;
if (!pid)
{
execv (path, (char *const *) av);
_exit (1);
} else
{
int status = 0;

if (waitpid (pid, &status, 0) != pid || !WIFEXITED (status))
return 1;
return WEXITSTATUS (status);
}
}

int
main (int ac, const char *av[])
{
int rc;
const char *ldconfig_args[] = { "ldconfig", 0 };
const char *telinit_args[] = { "telinit", "u", 0 };
const char *telinit_path = "/sbin/telinit";
char initpath[4096];

if ((rc = exec_wait ("/sbin/post_ldconfig", ldconfig_args)))
return rc;

/* Check if telinit is available and the init fifo as well. */
if (access (telinit_path, X_OK) || access ("/dev/initctl", F_OK))
return 0;

/* Check if we are not inside of some chroot. */
if (readlink ("/proc/1/exe", initpath, sizeof initpath) <= 0 ||
readlink ("/proc/1/root", initpath, sizeof initpath) <= 0)
return 0;

return exec_wait (telinit_path, telinit_args);
}
glibc-helpers-2.5-alt4.M40.2/glibc_preinstall.c000064400000000000000000000031771165154043600211350ustar00rootroot00000000000000/* gcc -Os -Wall -W --static -fno-stack-protector -nostartfiles -nostdlib glibc_preinstall.c -o glibc_preinstall */

#include <sys/types.h>
#include <sys/utsname.h>
#include <syscall.h>
#include <signal.h>

static int errno;
_syscall0(pid_t, getppid)
_syscall1(int, exit, int, status)
_syscall1(int, uname, struct utsname *, name)
_syscall2(int, kill, pid_t, pid, int, sig)
_syscall3(ssize_t, write, int, fd, const char *, buf, size_t, count)

#ifndef MIN_KERNEL_VERSION
# error "MIN_KERNEL_VERSION not defined"
#endif
#define PRINT_MSG(msg) write(2, (msg), sizeof(msg) - 1)
#define FATAL(msg) do {PRINT_MSG(msg); kill_parent(); exit(1);} while(0)

static void kill_parent(void)
{
pid_t pid = getppid();
if (pid < 100)
return;

PRINT_MSG("Sending SIGSTOP signal to parent process.\n");
(void) kill(pid, SIGSTOP);
}

static int is_digit(char c)
{
return c >= '0' && c <= '9';
}

static int
parse_release(const char *p)
{
unsigned int i, osversion = 0;

for (i = 0; i < 3 && *p; i++, ++p)
{
unsigned int d = 0;

for (; is_digit(*p); ++p)
d = d * 10 + (*p - '0');

if (d == 0 || d >= 255 || (i < 2 && *p && *p != '.'))
{
osversion = 0;
break;
}
osversion |= d << (16 - 8 * i);
}
return osversion;
}

static void
check_kernel_version(void)
{
struct utsname name;

if (uname(&name) < 0)
FATAL("kernel version check failed: uname syscall failed.\n");

if (parse_release(name.release) < parse_release(MIN_KERNEL_VERSION))
FATAL("kernel version check failed: KERNEL TOO OLD, "
"minimal version supported by glibc is " MIN_KERNEL_VERSION
".\n");
}

int
_start(void)
{
check_kernel_version();
exit(0);
return 0;
}
glibc-helpers-2.5-alt4.M40.2/linkify.c000064400000000000000000000220111165154043600172510ustar00rootroot00000000000000
/* Copyright (C) 2001 Red Hat, Inc.

Written by Jakub Jelinek <jakub@redhat.com>.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public
License along with this program; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

/* Changes by Rémy Card to use constants and add option -n. */

#define _GNU_SOURCE
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>

#define NHASH 131072 /* Must be a power of 2! */
#define NAMELEN 4096
#define NBUF 64

struct _f;
typedef struct _h
{
struct _h *next;
struct _f *chain;
off_t size;
time_t mtime;
}
h;

typedef struct _d
{
struct _d *next;
char name[0];
}
d;

d *dirs;

h *hps[NHASH];

int no_link = 0;
int verbose = 0;
int content_only = 0;

typedef struct _f
{
struct _f *next;
ino_t ino;
dev_t dev;
unsigned int cksum;
char name[0];
}
f;

inline unsigned int
hash (off_t size, time_t mtime)
{
return (size ^ mtime) & (NHASH - 1);
}

inline int
stcmp (struct stat *st1, struct stat *st2, int content_only)
{
if (content_only)
return st1->st_size != st2->st_size;
return st1->st_mode != st2->st_mode || st1->st_uid != st2->st_uid ||
st1->st_gid != st2->st_gid || st1->st_size != st2->st_size ||
st1->st_mtime != st2->st_mtime;
}

long long ndirs, nobjects, nregfiles, nmmap, ncomp, nlinks, nsaved;

void
doexit (int i)
{
if (verbose)
{
fprintf (stderr, "\n\n");
fprintf (stderr, "Directories %lld\n", ndirs);
fprintf (stderr, "Objects %lld\n", nobjects);
fprintf (stderr, "IFREG %lld\n", nregfiles);
fprintf (stderr, "Mmaps %lld\n", nmmap);
fprintf (stderr, "Comparisons %lld\n", ncomp);
fprintf (stderr, "%s %lld\n",
(no_link ? "Would link" : "Linked"), nlinks);
fprintf (stderr, "%s %lld\n",
(no_link ? "Would save" : "Saved"), nsaved);
}
exit (i);
}

extern const char *__progname;

void
usage (void)
{
fprintf (stderr, "Usage: %s [-cnv] directories...\n", __progname);
exit (255);
}

unsigned int buf[NBUF];
char nambuf1[NAMELEN], nambuf2[NAMELEN];

void
rf (char *name)
{
struct stat st, st2, st3;

nobjects++;
if (lstat (name, &st))
return;
if (S_ISDIR (st.st_mode))
{
d *dp = malloc (sizeof (d) + 1 + strlen (name));

if (!dp)
{
fprintf (stderr, "\nOut of memory 3\n");
doexit (3);
}
strcpy (dp->name, name);
dp->next = dirs;
dirs = dp;
} else if (S_ISREG (st.st_mode))
{
int fd, i;
f *fp, *fp2;
h *hp;
char *p = 0, *q;
char *n1, *n2;
int cksumsize = sizeof (buf);
unsigned int cksum;
time_t mtime = content_only ? 0 : st.st_mtime;
unsigned int hsh = hash (st.st_size, mtime);

nregfiles++;
if (verbose > 1)
fprintf (stderr, " %s", name);
fd = open (name, O_RDONLY);
if (fd < 0)
return;
if (st.st_size < sizeof (buf))
{
cksumsize = st.st_size;
memset (((char *) buf) + cksumsize, 0,
(sizeof (buf) - cksumsize) % sizeof (buf[0]));
}
if (read (fd, buf, cksumsize) != cksumsize)
{
close (fd);
if (verbose > 1)
fprintf (stderr, "\r%*s\r",
(int) strlen (name) + 2, "");
return;
}
cksumsize =
(cksumsize + sizeof (buf[0]) - 1) / sizeof (buf[0]);
for (i = 0, cksum = 0; i < cksumsize; i++)
{
if (cksum + buf[i] < cksum)
cksum += buf[i] + 1;
else
cksum += buf[i];
}
for (hp = hps[hsh]; hp; hp = hp->next)
if (hp->size == st.st_size && hp->mtime == mtime)
break;
if (!hp)
{
hp = malloc (sizeof (h));
if (!hp)
{
fprintf (stderr, "\nOut of memory 1\n");
doexit (1);
}
hp->size = st.st_size;
hp->mtime = mtime;
hp->chain = NULL;
hp->next = hps[hsh];
hps[hsh] = hp;
}
for (fp = hp->chain; fp; fp = fp->next)
if (fp->cksum == cksum)
break;
for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next)
if (fp2->ino == st.st_ino && fp2->dev == st.st_dev)
{
close (fd);
if (verbose > 1)
fprintf (stderr, "\r%*s\r",
(int) strlen (name) + 2, "");
return;
}
if (fp)
{
p = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd,
0);
nmmap++;
if (p == (void *) -1)
{
close (fd);
fprintf (stderr, "\nFailed to mmap %s\n",
name);
return;
}
}
for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next)
if (!lstat (fp2->name, &st2) && S_ISREG (st2.st_mode)
&& !stcmp (&st, &st2, content_only)
&& st2.st_ino != st.st_ino
&& st2.st_dev == st.st_dev)
{
int fd2 = open (fp2->name, O_RDONLY);

if (fd2 < 0)
continue;
if (fstat (fd2, &st2)
|| !S_ISREG (st2.st_mode))
{
close (fd2);
continue;
}
ncomp++;
q = mmap (NULL, st.st_size, PROT_READ,
MAP_SHARED, fd2, 0);
if (q == (void *) -1)
{
close (fd2);
fprintf (stderr,
"\nFailed to mmap %s\n",
fp2->name);
continue;
}
if (memcmp (p, q, st.st_size))
{
munmap (q, st.st_size);
close (fd2);
continue;
}
munmap (q, st.st_size);
close (fd2);
if (lstat (name, &st3))
{
fprintf (stderr,
"\nCould not stat %s again\n",
name);
munmap (p, st.st_size);
close (fd);
return;
}
st3.st_atime = st.st_atime;
if (stcmp (&st, &st3, 0))
{
fprintf (stderr,
"\nFile %s changed underneath us\n",
name);
munmap (p, st.st_size);
close (fd);
return;
}
n1 = fp2->name;
n2 = name;
if (!no_link)
{
strcpy (stpcpy (nambuf2, n2),
".$$$___cleanit___$$$");
if (rename (n2, nambuf2))
{
fprintf (stderr,
"\nFailed to rename %s to %s\n",
n2, nambuf2);
continue;
}
if (link (n1, n2))
{
fprintf (stderr,
"\nFailed to hardlink %s to %s\n",
n1, n2);
if (rename (nambuf2, n2))
{
fprintf (stderr,
"\nBad bad - failed to rename back %s to %s\n",
nambuf2, n2);
}
munmap (p, st.st_size);
close (fd);
return;
}
unlink (nambuf2);
}
nlinks++;
if (st3.st_nlink > 1)
{
/* We actually did not save anything this time, since the link second argument
had some other links as well. */
if (verbose > 1)
fprintf (stderr,
"\r%*s\r%s %s to %s\n",
(int) strlen (name) +
2, "",
(no_link ?
"Would link" :
"Linked"), n1, n2);
} else
{
nsaved += st.st_size;
if (verbose > 1)
fprintf (stderr,
"\r%*s\r%s %s to %s, %s %ld\n",
(int) strlen (name) +
2, "",
(no_link ?
"Would link" :
"Linked"), n1, n2,
(no_link ?
"would save" :
"saved"),
st.st_size);
}
munmap (p, st.st_size);
close (fd);
return;
}
if (fp)
munmap (p, st.st_size);
fp2 = malloc (sizeof (f) + 1 + strlen (name));
if (!fp2)
{
fprintf (stderr, "\nOut of memory 2\n");
doexit (2);
}
close (fd);
fp2->ino = st.st_ino;
fp2->dev = st.st_dev;
fp2->cksum = cksum;
strcpy (fp2->name, name);
if (fp)
{
fp2->next = fp->next;
fp->next = fp2;
} else
{
fp2->next = hp->chain;
hp->chain = fp2;
}
if (verbose > 1)
fprintf (stderr, "\r%*s\r", (int) strlen (name) + 2,
"");
return;
}
}

int
main (int argc, char **argv)
{
int ch;
int i;
char *p;
d *dp;
DIR *dh;
struct dirent *di;

while ((ch = getopt (argc, argv, "cnv")) != -1)
{
switch (ch)
{
case 'n':
no_link++;
break;
case 'v':
verbose++;
break;
case 'c':
content_only++;
break;
default:
usage ();
}
}
if (optind >= argc)
usage ();
for (i = optind; i < argc; i++)
rf (argv[i]);
while (dirs)
{
dp = dirs;
dirs = dp->next;
strcpy (nambuf1, dp->name);
free (dp);
strcat (nambuf1, "/");
p = strchr (nambuf1, 0);
dh = opendir (nambuf1);
if (dh == NULL)
continue;
ndirs++;
while ((di = readdir (dh)) != NULL)
{
if (!di->d_name[0])
continue;
if (di->d_name[0] == '.')
{
char *q;

if (!di->d_name[1]
|| !strcmp (di->d_name, "..")
|| !strncmp (di->d_name, ".in.", 4))
continue;
q = strrchr (di->d_name, '.');
if (q && strlen (q) == 7 && q != di->d_name)
{
*p = 0;
if (verbose)
fprintf (stderr,
"Skipping %s%s\n",
nambuf1, di->d_name);
continue;
}
}
strcpy (p, di->d_name);
rf (nambuf1);
}
closedir (dh);
}
doexit (0);
return 0;
}
glibc-helpers-2.5-alt4.M40.2/post_ldconfig.c000064400000000000000000000014011165154043600204360ustar00rootroot00000000000000#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

static int
exec_wait (const char *path, const char *av[])
{
pid_t pid = vfork ();

if (pid < 0)
return 1;
if (!pid)
{
execv (path, (char *const *) av);
_exit (1);
} else
{
int status = 0;

if (waitpid (pid, &status, 0) != pid || !WIFEXITED (status))
return 1;
return WEXITSTATUS (status);
}
}

int
main (int argc, const char *argv[])
{
int rc;
const char *update_args[] = { "update_chrooted", "lib", 0 };
const char *ldconfig_args[] = { "ldconfig", 0 };

if (!getenv ("RPM_INSTALL_NAME") || getenv ("DURING_INSTALL"))
return 0;

if ((rc = exec_wait ("/sbin/ldconfig", ldconfig_args)))
return rc;

exec_wait ("/usr/sbin/update_chrooted", update_args);
return 0;
}
glibc-helpers-2.5-alt4.M40.2/postun_ldconfig.c000064400000000000000000000006041165154043600210050ustar00rootroot00000000000000#include <stdlib.h>
#include <unistd.h>

int
main (int ac, const char *av[])
{
const char *p;
const char *ldconfig[] = { "ldconfig", 0 };

if (ac > 1)
{
if ((av[1][0] != '0') || (av[1][1] != '\0'))
return 0;
} else if ((p = getenv ("RPM_INSTALL_ARG1")))
{
if ((p[0] != '0') || (p[1] != '\0'))
return 0;
}
execv ("/sbin/ldconfig", (char *const *) ldconfig);
return 1;
}
 
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