Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 51560 Details for
Bug 82524
PATCH: emerge of debianutils-1.16.7 fails on solaris
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Implement failing parts of the code for solaris
debianutils-1.16.7-solaris.patch (text/plain), 8.04 KB, created by
devsk
on 2005-02-18 20:56:22 UTC
(
hide
)
Description:
Implement failing parts of the code for solaris
Filename:
MIME Type:
Creator:
devsk
Created:
2005-02-18 20:56:22 UTC
Size:
8.04 KB
patch
obsolete
>Files debianutils-1.16.7.orig/mktemp and debianutils-1.16.7/mktemp differ >diff -Nru debianutils-1.16.7.orig/mktemp.c debianutils-1.16.7/mktemp.c >--- debianutils-1.16.7.orig/mktemp.c 2002-09-28 12:17:03.000000000 -0700 >+++ debianutils-1.16.7/mktemp.c 2005-02-18 20:31:48.789710000 -0800 >@@ -31,14 +31,26 @@ > static const char rcsid[] = "$OpenBSD: mktemp.c,v 1.8 2002/02/16 21:27:49 millert Exp $"; > #endif /* not lint */ > >+#if defined(sun) >+#define _PATH_TMP "/tmp" >+#else > #include <paths.h> >+#endif > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >+#if defined(sun) >+#define warn printf >+#define warnx printf >+#include <sys/types.h> >+#include <sys/stat.h> >+#include <errno.h> >+#else > #include <err.h> >+#endif > >-void usage(void); >+void usage(char *progname); > > int > main(argc, argv) >@@ -48,6 +60,10 @@ > int ch, fd, uflag = 0, quiet = 0, tflag = 0, makedir = 0; > char *cp, *template, *tempfile, *prefix = _PATH_TMP; > size_t plen; >+#if defined(sun) >+ int retries=10; >+ char rndm[256]; >+#endif > > while ((ch = getopt(argc, argv, "dp:qtu")) != -1) > switch(ch) { >@@ -68,7 +84,7 @@ > uflag = 1; > break; > default: >- usage(); >+ usage(argv[0]); > } > > /* If no template specified use a default one (implies -t mode) */ >@@ -81,7 +97,7 @@ > tflag = 1; > break; > default: >- usage(); >+ usage(argv[0]); > } > > if (tflag) { >@@ -116,11 +132,36 @@ > } > > if (makedir) { >+#if defined(sun) >+ while (retries) >+ { >+ srandom((unsigned int)getpid()); >+ sprintf(rndm,"%d%d%d%d%d%d",random(),random(),random(), >+ random(),random(),random()); >+ strncpy(tempfile+strlen(tempfile)-6, rndm, 6); >+ if (mkdir(tempfile, S_IRWXU) < 0) >+ { >+ if (errno != EEXIST) >+ { >+ if (!quiet) warn("cannot make temp dir %s", tempfile); >+ exit(1); >+ } >+ retries--; >+ } >+ else break; >+ } >+ if (!retries) >+ { >+ if (!quiet) warn("cannot make temp dir %s", tempfile); >+ exit(1); >+ } >+#else > if (mkdtemp(tempfile) == NULL) { > if (!quiet) > warn("cannot make temp dir %s", tempfile); > exit(1); > } >+#endif > > if (uflag) > (void)rmdir(tempfile); >@@ -143,11 +184,9 @@ > } > > void >-usage() >+usage(char *progname) > { >- extern char *__progname; >- > (void)fprintf(stderr, >- "Usage: %s [-dqtu] [-p prefix] [template]\n", __progname); >+ "Usage: %s [-dqtu] [-p prefix] [template]\n", progname); > exit(1); > } >Files debianutils-1.16.7.orig/run-parts and debianutils-1.16.7/run-parts differ >diff -Nru debianutils-1.16.7.orig/run-parts.c debianutils-1.16.7/run-parts.c >--- debianutils-1.16.7.orig/run-parts.c 2005-02-18 20:29:31.573295000 -0800 >+++ debianutils-1.16.7/run-parts.c 2005-02-18 20:31:30.599038000 -0800 >@@ -20,7 +20,9 @@ > #include <sys/stat.h> > #include <unistd.h> > #include <fcntl.h> >+#if !defined(sun) > #include <getopt.h> >+#endif > #include <string.h> > #include <errno.h> > #include <ctype.h> >@@ -38,6 +40,26 @@ > int argcount = 0, argsize = 0; > char **args = 0; > >+#if defined(sun) >+ >+struct option >+{ >+# if (defined __STDC__ && __STDC__) || defined __cplusplus >+ const char *name; >+# else >+ char *name; >+# endif >+ int has_arg; >+ int *flag; >+ int val; >+}; >+ >+# define no_argument 0 >+# define required_argument 1 >+# define optional_argument 2 >+ >+#endif >+ > void error (char *format,...) > { > va_list ap; >@@ -279,6 +301,49 @@ > } > } > >+#if defined(sun) >+ >+int scandir(const char *dir, struct dirent ***namelist, >+ int(*filter)(const struct dirent *), >+ int(*compar)(const struct dirent **, const struct dirent **)) >+{ >+ DIR *dirp; >+ struct dirent *dp; >+ struct dirent **dp_array; >+ int i=0; >+ >+ dirp = opendir(dir); >+ while (dirp) { >+ errno = 0; >+ if ((dp = readdir(dirp)) != NULL) { >+ if ((strcmp(dp->d_name, ".") != 0) && (strcmp(dp->d_name, "..") != 0) && filter(dp)) { >+ if (i == 0) >+ dp_array = (struct dirent **)malloc(sizeof(struct dirent *)); >+ else >+ dp_array = (struct dirent **)realloc(dp_array, (i+1)*sizeof(struct dirent *)); >+ dp_array[i] = (struct dirent *)malloc(sizeof(struct dirent)); >+ memcpy(dp_array[i], dp, sizeof(struct dirent)); >+ i++; >+ } >+ } else { >+ if (errno == 0) { >+ /* we are done, sort and return */ >+ qsort((void *)dp_array, i, sizeof(struct dirent *), compar); >+ *namelist = dp_array; >+ closedir(dirp); >+ return 0; >+ } >+ return -1; >+ } >+ } >+} >+ >+int alphasort(const struct dirent **s1, const struct dirent **s2) >+{ >+ return strcoll((*s2)->d_name, (*s2)->d_name); >+} >+ >+#endif /* sun */ > > /* Find the parts to run & call run_part() */ > void run_parts (char *dirname) >@@ -351,6 +416,53 @@ > /* Process options */ > int main (int argc, char *argv[]) > { >+ >+#if defined(sun) >+ >+ int i, j, len; >+ static struct option long_options[] = { >+ {"test", 0, &test_mode, 't'}, >+ {"verbose", 0, &verbose_mode, 'V'}, >+ {"report", 0, &report_mode, 'r'}, >+ {"umask", 1, 0, 'u'}, >+ {"arg", 1, 0, 'a'}, >+ {"help", 0, 0, 'h'}, >+ {"version", 0, 0, 'v'}, >+ {0, 0, 0, 0} >+ }; >+ >+ len = sizeof(long_options) / sizeof(struct option); >+ for (i=1;i<argc;i++) >+ { >+ for (j=0;j<len-1;j++) >+ if (strcmp(argv[i]+2, long_options[j].name) == 0) >+ { >+ if (long_options[j].val != 1) >+ { >+ argv[i][0] = '-'; >+ argv[i][1] = (char)long_options[j].val; >+ argv[i][2] = '\0'; >+ } >+ if (long_options[j].flag) >+ *(long_options[j].flag) = 1; >+ } >+ } >+ >+#else >+ >+ static struct option long_options[] = { >+ {"test", 0, &test_mode, 1}, >+ {"verbose", 0, &verbose_mode, 1}, >+ {"report", 0, &report_mode, 1}, >+ {"umask", 1, 0, 'u'}, >+ {"arg", 1, 0, 'a'}, >+ {"help", 0, 0, 'h'}, >+ {"version", 0, 0, 'v'}, >+ {0, 0, 0, 0} >+ }; >+ >+#endif >+ > umask (022); > add_argument(0); > >@@ -358,18 +470,15 @@ > int c; > int option_index = 0; > >- static struct option long_options[] = { >- {"test", 0, &test_mode, 1}, >- {"verbose", 0, &verbose_mode, 1}, >- {"report", 0, &report_mode, 1}, >- {"umask", 1, 0, 'u'}, >- {"arg", 1, 0, 'a'}, >- {"help", 0, 0, 'h'}, >- {"version", 0, 0, 'v'}, >- {0, 0, 0, 0} >- }; >+#if defined(sun) >+ >+ c = getopt (argc, argv, "u:htVra:v"); >+ >+#else > > c = getopt_long (argc, argv, "u:ha:v", long_options, &option_index); >+ >+#endif > if (c == EOF) > break; > switch (c) { >@@ -387,6 +496,15 @@ > case 'v': > version (); > break; >+ >+#if defined(sun) >+ >+ case 'V': >+ case 't': >+ case 'r': >+ break; >+ >+#endif > default: > fprintf(stderr, "Try `run-parts --help' for more information.\n"); > exit (1); >Files debianutils-1.16.7.orig/tempfile and debianutils-1.16.7/tempfile differ >diff -Nru debianutils-1.16.7.orig/tempfile.c debianutils-1.16.7/tempfile.c >--- debianutils-1.16.7.orig/tempfile.c 2005-02-18 20:29:31.577375000 -0800 >+++ debianutils-1.16.7/tempfile.c 2005-02-18 20:31:37.685245000 -0800 >@@ -1,7 +1,9 @@ > #include <stdio.h> > #include <unistd.h> > #include <stdlib.h> >+#if !defined(sun) > #include <getopt.h> >+#endif > #include <errno.h> > #include <sys/types.h> > #include <sys/stat.h> >@@ -10,6 +12,26 @@ > > char *progname; > >+#if defined(sun) >+ >+struct option >+{ >+# if (defined __STDC__ && __STDC__) || defined __cplusplus >+ const char *name; >+# else >+ char *name; >+# endif >+ int has_arg; >+ int *flag; >+ int val; >+}; >+ >+# define no_argument 0 >+# define required_argument 1 >+# define optional_argument 2 >+ >+#endif >+ > void > usage (int status) > { >@@ -54,6 +76,9 @@ > int > main (int argc, char **argv) > { >+#if defined(sun) >+ int i, j, len; >+#endif > char *name=0, *dir=0, *pfx=0, *sfx=0; > mode_t mode = 0600; > int fd, optc; >@@ -69,7 +94,27 @@ > }; > progname = argv[0]; > >+#if defined(sun) >+ >+ len = sizeof(long_options) / sizeof(struct option); >+ for (i=1;i<argc;i++) >+ { >+ for (j=0;j<len-1;j++) >+ if (strcmp(argv[i]+2, long_options[j].name) == 0) >+ { >+ argv[i][0] = '-'; >+ argv[i][1] = (char)long_options[j].val; >+ argv[i][2] = '\0'; >+ } >+ } >+ >+ while ((optc = getopt (argc, argv, "p:s:d:m:n:hv")) >+ >+#else >+ > while ((optc = getopt_long (argc, argv, "p:s:d:m:n:", long_options, 0)) >+ >+#endif > != EOF) { > switch (optc) { > case 0:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 82524
: 51560