[Initscripts-ng-commits] r791 - in /branches/insserv-1.11.10: Makefile debian/changelog insserv-1.11.10.lsm insserv-1.11.9.lsm insserv.c listing.h tests/suite
kelmo-guest at users.alioth.debian.org
kelmo-guest at users.alioth.debian.org
Tue Jul 22 15:34:03 UTC 2008
Author: kelmo-guest
Date: Tue Jul 22 15:34:03 2008
New Revision: 791
URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=791
Log:
Import new upstream 1.11.10 sources.
Added:
branches/insserv-1.11.10/insserv-1.11.10.lsm
Removed:
branches/insserv-1.11.10/insserv-1.11.9.lsm
Modified:
branches/insserv-1.11.10/Makefile
branches/insserv-1.11.10/debian/changelog
branches/insserv-1.11.10/insserv.c
branches/insserv-1.11.10/listing.h
branches/insserv-1.11.10/tests/suite
Modified: branches/insserv-1.11.10/Makefile
URL: http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.10/Makefile?rev=791&op=diff
==============================================================================
--- branches/insserv-1.11.10/Makefile (original)
+++ branches/insserv-1.11.10/Makefile Tue Jul 22 15:34:03 2008
@@ -11,7 +11,7 @@
DEBUG =
ISSUSE = -DSUSE
DESTDIR =
-VERSION = 1.11.9
+VERSION = 1.11.10
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
#
@@ -27,7 +27,7 @@
COPTS = -g -O2
endif
endif
- CFLAGS = -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
+ CFLAGS = -W -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
$(ISSUSE) -DINITDIR=\"$(INITDIR)\" -DINSCONF=\"$(INSCONF)\" -pipe
CLOOP = -falign-loops=0
LDFLAGS = -Wl,-O,3,--relax
@@ -56,12 +56,23 @@
CONFDIR = $(DESTDIR)/etc
LSBDIR = $(DESTDIR)/lib/lsb
USRLSBDIR = $(DESTDIR)/usr/lib/lsb
+
+#
+# Determine if glibc provides the atfile functions
+#
+ FUNCTIONS = fstatat openat readlinkat symlinkat unlinkat
+ CTEST = $(CC) -nostdinc -fno-builtin -o /dev/null -xc
+ cc-function = $(shell echo -e 'void *$(1)();\nint main(){return($(1)(0)?0:1);}'|$(CTEST) - -l$(2:lib%=%) > /dev/null 2>&1 && echo $(1))
#
#
#
+
TODO = insserv insserv.8
-all: .depend.listing .depend.insserv $(TODO)
+all: $(TODO)
+
+insserv: insserv.o listing.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
listing.o: listing.c listing.h .system
$(CC) $(CFLAGS) $(CLOOP) -c $<
@@ -69,8 +80,16 @@
insserv.o: insserv.c listing.h .system
$(CC) $(CFLAGS) $(CLOOP) -c $<
-insserv: insserv.o listing.o
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+listing.h: config.h .system
+
+config.h:
+ @echo '/* Generated automatically by running make -- do not edit */' > config.h
+ @echo '#ifndef CONFIG_H' >> config.h
+ @echo '#define CONFIG_H' >> config.h
+ @for def in $(foreach func,$(FUNCTIONS),$(call cc-function,$(func),libc)); do \
+ echo "#define HAS_$$def"; \
+ done >> config.h
+ @echo '#endif' >> config.h
ifeq ($(ISSUSE),-DSUSE)
insserv.8: insserv.8.in .system
@@ -86,17 +105,18 @@
.force:
+.PHONY: clean
clean:
- $(RM) *.o *~ $(TODO) .depend.* .system
+ $(RM) *.o *~ $(TODO) config.h .depend.* .system
ifneq ($(MAKECMDGOALS),clean)
--include .depend.listing .depend.insserv
+-include .depend.listing .depend.insserv
-.depend.listing:
+.depend.listing:: listing.c listing.h
@$(CC) $(CFLAGS) -M listing.c >$@ 2>/dev/null
-.depend.insserv:
+.depend.insserv:: insserv.c listing.h
@$(CC) $(CFLAGS) -M insserv.c >$@ 2>/dev/null
endif
Modified: branches/insserv-1.11.10/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.10/debian/changelog?rev=791&op=diff
==============================================================================
--- branches/insserv-1.11.10/debian/changelog (original)
+++ branches/insserv-1.11.10/debian/changelog Tue Jul 22 15:34:03 2008
@@ -1,4 +1,4 @@
-insserv (1.11.9-1) UNRELEASED; urgency=low
+insserv (1.11.10-1) UNRELEASED; urgency=low
DO NOT RELEASE
@@ -51,7 +51,7 @@
unproperly replaced with empty Default-Start or Default-Stop.
* Make test_adding_start() case a more realistic example.
- -- Kel Modderman <kel at otaku42.de> Tue, 22 Jul 2008 18:05:40 +1000
+ -- Kel Modderman <kel at otaku42.de> Wed, 23 Jul 2008 01:32:37 +1000
insserv (1.11.0-9) unstable; urgency=low
Added: branches/insserv-1.11.10/insserv-1.11.10.lsm
URL: http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.10/insserv-1.11.10.lsm?rev=791&op=file
==============================================================================
--- branches/insserv-1.11.10/insserv-1.11.10.lsm (added)
+++ branches/insserv-1.11.10/insserv-1.11.10.lsm Tue Jul 22 15:34:03 2008
@@ -1,0 +1,29 @@
+Begin3
+\
+Title: insserv tool for boot scripts
+\
+Version: 1.11.10
+\
+Entered-date: 22JUL08
+\
+Description: Used for enabling of installed boot scripts
+\
+ by scanning comment headers which are LSB conform.
+\
+Keywords: boot service control, LSB
+\
+Author: Werner Fink <werner at suse.de>
+\
+Maintained-by: Werner Fink <werner at suse.de>
+\
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+\
+ @UNKNOWN insserv-1.11.10.tar.gz
+\
+Alternate-site: ftp.suse.com /pub/projects/init
+\
+Platforms: Linux with System VR2 or higher boot scheme
+\
+Copying-policy: GPL
+\
+End
Modified: branches/insserv-1.11.10/insserv.c
URL: http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.10/insserv.c?rev=791&op=diff
==============================================================================
--- branches/insserv-1.11.10/insserv.c (original)
+++ branches/insserv-1.11.10/insserv.c Tue Jul 22 15:34:03 2008
@@ -281,6 +281,7 @@
error("%s", strerror(errno));
memset(this, 0, alignof(req_t));
insert(&this->list, list->prev);
+ this->flags = bit;
this->serv = need;
}
/* Expand requested services for sorting */
@@ -402,34 +403,35 @@
static boolean chkdependencies(service_t *restrict serv) attribute((nonnull(1)));
static boolean chkdependencies(service_t *restrict serv)
{
+ const char * const name = serv->name;
+ boolean ret = true;
list_t * ptr;
- boolean ret = true;
list_for_each(ptr, s_start) {
- service_t * serv = getservice(ptr);
+ service_t * cur = getservice(ptr);
list_t * pos;
- if (!serv)
- continue;
-
- if ((serv->attr.flags & SERV_ENABLED) == 0)
- continue;
-
- if (serv->attr.flags & SERV_DUPLET)
- continue;
-
- if (list_empty(&serv->sort.req))
- continue;
-
- np_list_for_each(pos, &serv->sort.req) {
+ if (!cur)
+ continue;
+
+ if ((cur->attr.flags & SERV_ENABLED) == 0)
+ continue;
+
+ if (cur->attr.flags & SERV_DUPLET)
+ continue;
+
+ if (list_empty(&cur->sort.req))
+ continue;
+
+ np_list_for_each(pos, &cur->sort.req) {
req_t *req = getreq(pos);
if (!(req->flags & REQ_MUST))
continue;
- if (!strcmp(req->serv->name, serv->name)) {
+ if (!strcmp(req->serv->name, name)) {
warn("Service %s has to be enabled to start service %s\n",
- serv->name, serv->name);
+ name, cur->name);
ret = false;
}
}
@@ -1292,7 +1294,13 @@
error("exiting now!\n");
}
- if (verbose && (begin && end && (!provides || (provides == empty) || !required_start || !required_stop)))
+ if (begin && end && (!provides || (provides == empty) ||
+#ifdef SUSE
+ !required_start || !required_stop || !default_start
+#else /* not SUSE */
+ !required_start || !required_stop || !default_start || !default_stop
+#endif /* not SUSE */
+ ))
{
char *name = basename(path);
if (*name == 'S' || *name == 'K')
@@ -1306,6 +1314,12 @@
warn("missing `Required-Start:' entry: please add even if empty.\n");
if (!required_stop)
warn("missing `Required-Stop:' entry: please add even if empty.\n");
+ if (!default_start)
+ warn("missing `Default-Start:' entry: please add even if empty.\n");
+#ifndef SUSE
+ if (!default_stop)
+ warn("missing `Default-Stop:' entry: please add even if empty.\n");
+#endif
}
#undef provides
@@ -1325,8 +1339,8 @@
* Follow symlinks, return the basename of the file pointed to by
* symlinks or the basename of the current path if no symlink.
*/
-static char *scriptname(int dfd, const char *restrict const path, char **restrict first) attribute((nonnull(2)));
-static char *scriptname(int dfd, const char *restrict const path, char **restrict first)
+static char * scriptname(int dfd, const char *restrict const path, char **restrict first) attribute((malloc,nonnull(2)));
+static char * scriptname(int dfd, const char *restrict const path, char **restrict first)
{
uint deep = 0;
char linkbuf[PATH_MAX+1];
@@ -1403,7 +1417,7 @@
if (stat(fullpath, &statbuf) == 0 && S_ISREG(statbuf.st_mode))
ret = scan_lsb_headers(-1, fullpath, cache, ignore);
- if (ret)
+ if (ret & FOUND_LSB_HEADER)
ret |= FOUND_LSB_OVERRIDE;
return ret;
}
@@ -1418,7 +1432,7 @@
const boolean cache, const boolean ignore)
{
char * name = scriptname(dfd, path, first);
- uchar ret = FOUND_LSB_DEFAULT;
+ uchar ret = 0;
if (!name)
return ret;
@@ -1429,19 +1443,19 @@
#ifdef SUSE
/* Common script ... */
if (!strcmp(name, "halt")) {
- ret |= FOUND_LSB_HEADER;
+ ret |= (FOUND_LSB_HEADER|FOUND_LSB_DEFAULT);
goto out;
}
/* ... and its link */
if (!strcmp(name, "reboot")) {
- ret |= FOUND_LSB_HEADER;
+ ret |= (FOUND_LSB_HEADER|FOUND_LSB_DEFAULT);
goto out;
}
/* Common script for single mode */
if (!strcmp(name, "single")) {
- ret |= FOUND_LSB_HEADER;
+ ret |= (FOUND_LSB_HEADER|FOUND_LSB_DEFAULT);
goto out;
}
#endif /* SUSE */
@@ -1450,8 +1464,10 @@
ret |= scan_lsb_headers(dfd, path, cache, ignore);
/* Load values if the override file exist */
- if ((ret & FOUND_LSB_DEFAULT) == FOUND_LSB_DEFAULT)
+ if ((ret & FOUND_LSB_HEADER) == 0)
ret |= load_overrides("/usr/share/insserv/overrides", name, cache, ignore);
+ else
+ ret |= FOUND_LSB_DEFAULT;
/*
* Allow host-specific overrides to replace the content in the
@@ -1675,7 +1691,7 @@
script_inf.provides = xstrdup(ptr);
#ifndef SUSE
- if (lsb == FOUND_LSB_DEFAULT) {
+ if (!lsb) {
script_inf.required_start = xstrdup(DEFAULT_DEPENDENCY);
script_inf.required_stop = xstrdup(DEFAULT_DEPENDENCY);
}
@@ -1711,11 +1727,11 @@
continue;
service->attr.flags |= (SERV_KNOWN|SERV_ENABLED);
- if (lsb == FOUND_LSB_DEFAULT)
+ if (!lsb)
service->attr.flags |= SERV_NOTLSB;
if ((lsb & FOUND_LSB_HEADER) == 0) {
- if ((lsb & FOUND_LSB_OVERRIDE) == 0)
+ if ((lsb & (FOUND_LSB_DEFAULT|FOUND_LSB_OVERRIDE)) == 0)
warn("warning: script '%s' missing LSB tags and overrides\n", d->d_name);
else
warn("warning: script '%s' missing LSB tags\n", d->d_name);
@@ -1723,24 +1739,12 @@
if (script_inf.required_start && script_inf.required_start != empty) {
rememberreq(service, REQ_MUST, script_inf.required_start);
-#ifdef SUSE
- if (!script_inf.required_stop || script_inf.required_stop == empty)
- script_inf.required_stop = xstrdup(script_inf.required_start);
-#endif /* SUSE */
}
if (script_inf.should_start && script_inf.should_start != empty) {
rememberreq(service, REQ_SHLD, script_inf.should_start);
-#ifdef SUSE
- if (!script_inf.should_stop || script_inf.should_stop == empty)
- script_inf.should_stop = xstrdup(script_inf.should_start);
-#endif /* SUSE */
}
if (script_inf.start_before && script_inf.start_before != empty) {
reversereq(service, REQ_SHLD, script_inf.start_before);
-#ifdef SUSE
- if (!script_inf.stop_after || script_inf.stop_after == empty)
- script_inf.stop_after = xstrdup(script_inf.start_before);
-#endif /* SUSE */
}
if (script_inf.required_stop && script_inf.required_stop != empty) {
rememberreq(service, REQ_MUST|REQ_KILL, script_inf.required_stop);
@@ -2208,6 +2212,7 @@
char * path = INITDIR;
char * override_path = OVERRIDEDIR;
char * insconf = INSCONF;
+ const char *const ipath = path;
int runlevel, c, dfd;
boolean del = false;
boolean defaults = false;
@@ -2246,8 +2251,9 @@
case 'p':
if (optarg == (char*)0 || *optarg == '\0')
goto err;
+ if (path != ipath) free(path);
l = strlen(optarg) - 1;
- path = optarg;
+ path = xstrdup(optarg);
if (*(path+l) == '/')
*(path+l) = '\0';
break;
@@ -2298,7 +2304,8 @@
if (S_ISDIR(st_script.st_mode)) {
const size_t l = strlen(*argv) - 1;
- path = *argv;
+ if (path != ipath) free(path);
+ path = xstrdup(*argv);
if (*(path+l) == '/')
*(path+l) = '\0';
@@ -2308,12 +2315,14 @@
error("usage: %s [[-r] init_script|init_directory]\n", myname);
} else {
- char * base;
-
- if ((base = strrchr(*argv, '/'))) {
+ char * base, * ptr = xstrdup(*argv);
+
+ if ((base = strrchr(ptr, '/'))) {
+ if (path != ipath) free(path);
*base = '\0';
- path = *argv;
- }
+ path = ptr;
+ } else
+ free(ptr);
}
}
@@ -2501,7 +2510,7 @@
lsb = scan_script_defaults(dfd, d->d_name, override_path, (char**)0, false, ignore);
if ((lsb & FOUND_LSB_HEADER) == 0) {
- if ((lsb & FOUND_LSB_OVERRIDE) == 0)
+ if ((lsb & (FOUND_LSB_DEFAULT|FOUND_LSB_OVERRIDE)) == 0)
warn("warning: script '%s' missing LSB tags and overrides\n", d->d_name);
else
warn("warning: script '%s' missing LSB tags\n", d->d_name);
@@ -2514,7 +2523,7 @@
serv = getorig(serv);
makeprov(serv, d->d_name);
runlevels(serv, 'S', "0");
- serv->attr.flags |= (SERV_ALL|SERV_NOSTOP);
+ serv->attr.flags |= (SERV_ALL|SERV_NOSTOP|SERV_INTRACT);
continue;
}
@@ -2524,7 +2533,7 @@
serv = getorig(serv);
makeprov(serv, d->d_name);
runlevels(serv, 'S', "6");
- serv->attr.flags |= (SERV_ALL|SERV_NOSTOP);
+ serv->attr.flags |= (SERV_ALL|SERV_NOSTOP|SERV_INTRACT);
continue;
}
@@ -2534,14 +2543,14 @@
serv = getorig(serv);
makeprov(serv, d->d_name);
runlevels(serv, 'S', "1 S");
- serv->attr.flags |= (SERV_ALL|SERV_NOSTOP);
+ serv->attr.flags |= (SERV_ALL|SERV_NOSTOP|SERV_INTRACT);
rememberreq(serv, REQ_SHLD, "kbd");
continue;
}
#endif /* SUSE */
#ifndef SUSE
- if (lsb == FOUND_LSB_DEFAULT) {
+ if (!lsb) {
script_inf.required_start = xstrdup(DEFAULT_DEPENDENCY);
script_inf.required_stop = xstrdup(DEFAULT_DEPENDENCY);
script_inf.default_start = xstrdup(DEFAULT_START_LVL);
@@ -2710,17 +2719,9 @@
if (!known) {
if (script_inf.required_start && script_inf.required_start != empty) {
rememberreq(service, REQ_MUST, script_inf.required_start);
-#ifdef SUSE
- if (!script_inf.required_stop || script_inf.required_stop == empty)
- script_inf.required_stop = xstrdup(script_inf.required_start);
-#endif /* SUSE */
}
if (script_inf.should_start && script_inf.should_start != empty) {
rememberreq(service, REQ_SHLD, script_inf.should_start);
-#ifdef SUSE
- if (!script_inf.should_stop || script_inf.should_stop == empty)
- script_inf.should_stop = xstrdup(script_inf.should_start);
-#endif /* SUSE */
}
if (script_inf.required_stop && script_inf.required_stop != empty) {
rememberreq(service, REQ_MUST|REQ_KILL, script_inf.required_stop);
@@ -2732,10 +2733,6 @@
if (script_inf.start_before && script_inf.start_before != empty) {
reversereq(service, REQ_SHLD, script_inf.start_before);
-#ifdef SUSE
- if (!script_inf.stop_after || script_inf.stop_after == empty)
- script_inf.stop_after = xstrdup(script_inf.start_before);
-#endif /* SUSE */
}
if (script_inf.stop_after && script_inf.stop_after != empty) {
reversereq(service, REQ_SHLD|REQ_KILL, script_inf.stop_after);
@@ -2768,8 +2765,8 @@
*/
if (!defaults && (deflvls != service->start->lvl)) {
if (!del && chkfor(d->d_name, argv, argc) && !(argr[curr_argc]))
- warn("Warning, current start runlevel(s) %s of script `%s' overwrites defaults %s.\n",
- lvl2str(service->start->lvl), d->d_name, lvl2str(deflvls));
+ warn("Warning, current start runlevel(s) (%s) of script `%s' overwrites defaults (%s).\n",
+ service->start->lvl ? lvl2str(service->start->lvl) : "empty", d->d_name, lvl2str(deflvls));
}
} else
/*
@@ -2778,15 +2775,17 @@
*/
service->start->lvl = deflvls;
- } else {
+ } else if (!script_inf.default_start) {
/*
* Could be a none LSB script, use info from current link scheme.
* If not found use default.
*/
if (service->attr.flags & SERV_ENABLED)
script_inf.default_start = lvl2str(service->start->lvl);
+#ifdef SUSE
else
script_inf.default_start = xstrdup(DEFAULT_START_LVL);
+#endif /* SUSE */
}
#ifdef SUSE
/*
@@ -2794,7 +2793,10 @@
* Therefore default_stop is ignored and overwriten by default_start.
*/
xreset(script_inf.default_stop);
- script_inf.default_stop = xstrdup(script_inf.default_start);
+ if (script_inf.default_start && script_inf.default_start != empty)
+ script_inf.default_stop = xstrdup(script_inf.default_start);
+ else
+ script_inf.default_stop = empty;
oneway(script_inf.default_stop);
#endif /* SUSE */
if (script_inf.default_stop && script_inf.default_stop != empty) {
@@ -2811,8 +2813,8 @@
*/
if (!defaults && (deflvlk != service->stopp->lvl)) {
if (!del && chkfor(d->d_name, argv, argc) && !(argr[curr_argc]))
- warn("Warning, current stop runlevel(s) %s of script `%s' overwrites defaults %s.\n",
- lvl2str(service->stopp->lvl), d->d_name, lvl2str(deflvlk));
+ warn("Warning, current stop runlevel(s) (%s) of script `%s' overwrites defaults (%s).\n",
+ service->stopp->lvl ? lvl2str(service->stopp->lvl) : "empty", d->d_name, lvl2str(deflvlk));
}
} else
/*
@@ -2821,15 +2823,17 @@
*/
service->stopp->lvl = deflvlk;
- } else {
+ } else if (!script_inf.default_stop) {
/*
* Could be a none LSB script, use info from current link scheme.
* If not found use default.
*/
if (service->attr.flags & SERV_ENABLED)
script_inf.default_stop = lvl2str(service->stopp->lvl);
+#ifdef SUSE
else
script_inf.default_stop = xstrdup(DEFAULT_STOP_LVL);
+#endif /* SUSE */
}
}
}
@@ -2837,10 +2841,28 @@
}
/* Ahh ... set default multiuser with network */
- if (!script_inf.default_start || script_inf.default_start == empty)
- script_inf.default_start = xstrdup(DEFAULT_START_LVL);
- if (!script_inf.default_stop || script_inf.default_start == empty)
- script_inf.default_stop = xstrdup(DEFAULT_STOP_LVL);
+ if (!script_inf.default_start) {
+#ifdef SUSE
+ if (script_inf.default_start == empty)
+ script_inf.default_start = xstrdup(DEFAULT_START_LVL);
+ else
+#endif /* not SUSE */
+ {
+ warn("Default-Start undefined, assuming empty start runlevel(s) for script `%s'\n", d->d_name);
+ script_inf.default_start = empty;
+ }
+ }
+ if (!script_inf.default_stop) {
+#ifdef SUSE
+ if (script_inf.default_start == empty)
+ script_inf.default_stop = xstrdup(DEFAULT_STOP_LVL);
+ else
+#endif /* not SUSE */
+ {
+ warn("Default-Stop undefined, assuming empty stop runlevel(s) for script `%s'\n", d->d_name);
+ script_inf.default_stop = empty;
+ }
+ }
if (chkfor(d->d_name, argv, argc) && !defaults && !del) {
if (argr[curr_argc]) {
@@ -2928,7 +2950,7 @@
script_inf.provides = begin;
/* Remember if not LSB conform script */
- if (lsb == FOUND_LSB_DEFAULT && service) {
+ if (!lsb && service) {
service = getorig(service);
service->attr.flags |= SERV_NOTLSB;
}
@@ -2960,7 +2982,7 @@
*/
follow_all();
if (is_loop_detected() && !ignore)
- error("exiting now!\n");
+ error("exiting without changing boot order!\n");
/*
* Be sure that interactive scripts are the only member of
@@ -3313,5 +3335,11 @@
*/
popd();
+ /*
+ * Make valgrind happy
+ */
+ if (path != ipath) free(path);
+ if (root) free(root);
+
return 0;
}
Modified: branches/insserv-1.11.10/listing.h
URL: http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.10/listing.h?rev=791&op=diff
==============================================================================
--- branches/insserv-1.11.10/listing.h (original)
+++ branches/insserv-1.11.10/listing.h Tue Jul 22 15:34:03 2008
@@ -11,8 +11,8 @@
*/
#include <stddef.h>
-#include <sys/syscall.h>
#include <sys/types.h>
+#include "config.h"
typedef enum _boolean {false, true} boolean;
typedef unsigned char uchar;
@@ -306,7 +306,8 @@
#define xreset(ptr) \
{char *restrict tmp = (char *restrict)ptr; if (ptr && *tmp) free(ptr);} ptr = NULL
-#if defined SYS_unlinkat
+
+#if defined(HAS_unlinkat) && defined(_ATFILE_SOURCE)
# define xremove(d,x) (__extension__ ({ if ((dryrun ? 0 : \
(unlinkat(d,x,0) != 0 && (errno != EISDIR || unlinkat(d,x,AT_REMOVEDIR) != 0)))) \
warn ("can not remove(%s%s): %s\n", rcd, x, strerror(errno)); \
@@ -318,7 +319,7 @@
else \
info("remove service %s/%s%s\n", path, rcd, x); }))
#endif
-#if defined SYS_symlinkat
+#if defined(HAS_symlinkat) && defined(_ATFILE_SOURCE)
# define xsymlink(d,x,y) (__extension__ ({ if ((dryrun ? 0 : (symlinkat(x, d, y) != 0))) \
warn ("can not symlink(%s, %s%s): %s\n", x, rcd, y, strerror(errno)); \
else \
@@ -329,19 +330,19 @@
else \
info("enable service %s -> %s/%s%s\n", x, path, rcd, y); }))
#endif
-#if defined SYS_fstatat64
+#if defined(HAS_fstatat) && defined(_ATFILE_SOURCE)
# define xstat(d,x,s) (__extension__ ({ fstatat(d,x,s, 0); }))
# define xlstat(d,x,s) (__extension__ ({ fstatat(d,x,s, AT_SYMLINK_NOFOLLOW); }))
#else
# define xstat(d,x,s) (__extension__ ({ stat(x,s); }))
# define xlstat(d,x,s) (__extension__ ({ lstat(x,s); }))
#endif
-#if defined SYS_fstatat64
+#if defined(HAS_readlinkat) && defined(_ATFILE_SOURCE)
# define xreadlink(d,x,b,l) (__extension__ ({ readlinkat(d,x,b,l); }))
#else
# define xreadlink(d,x,b,l) (__extension__ ({ readlink(x,b,l); }))
#endif
-#if defined SYS_openat
+#if defined(HAS_openat) && defined(_ATFILE_SOURCE)
# define xopen(d,x,f) (__extension__ ({ openat(d,x,f); }))
#else
# define xopen(d,x,f) (__extension__ ({ open(x,f); }))
Modified: branches/insserv-1.11.10/tests/suite
URL: http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.10/tests/suite?rev=791&op=diff
==============================================================================
--- branches/insserv-1.11.10/tests/suite (original)
+++ branches/insserv-1.11.10/tests/suite Tue Jul 22 15:34:03 2008
@@ -15,12 +15,15 @@
: ${debug:=""}
declare -i retval=0
+declare -i checkfailed=0
+declare -i testcount=0
+declare -i testfailed=0
finish_test ()
{
if test 0 -ne $retval ; then
- echo "error: one or more test failed."
+ echo "error: $testcount test executed, $checkfailed fatal tests failed, $testfailed nonfatal test failed."
else
- echo "success: no test failed."
+ echo "success: $testcount test executed, $testfailed nonfatal tests failed."
fi
rm -rf ${tmpdir}
return $retval
@@ -172,15 +175,22 @@
echo "$path"
}
+counttest ()
+{
+ testcount=$(expr $testcount + 1)
+}
+
error ()
{
echo error: $@
+ checkfailed=$(expr $checkfailed + 1)
retval=1
}
warning ()
{
echo warning: $@
+ testfailed=$(expr $testfailed + 1)
}
addscript ()
@@ -204,6 +214,7 @@
local script=$1; shift
local ret=0
test -L ${rcdpath}/[KS][0-9][0-9]$script || ret=1
+ counttest
return $ret
}
@@ -271,6 +282,7 @@
fi
popd &> /dev/null
test "$order" = "$script1 $script2" || ret=1
+ counttest
return $ret
}
More information about the Initscripts-ng-commits
mailing list