X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/b9d8f082520079c127d772b8fb60d4e8e418da1d..94fdc64f0f172649d4a3895c6d53db0ddafb1c3f:/gen/passwd.dc diff --git a/gen/passwd.dc b/gen/passwd.dc index 4964a554..52b8101a 100644 --- a/gen/passwd.dc +++ b/gen/passwd.dc @@ -2,8 +2,13 @@ * * This generates a master /etc/passwd containing all active (status != 0) * accounts. + * + * (c) Copyright 1988 by the Massachusetts Institute of Technology. + * For copying and distribution information, please see the file + * . */ +#include #include #include #include @@ -12,6 +17,7 @@ extern int errno; char *ingres_date_and_time(); +char *whoami = "passwd.gen"; main(argc, argv) @@ -23,7 +29,9 @@ char **argv; struct stat sb; ## char login[9], shell[33], fullname[33], oa[17], op[13], hp[17], *filetime; ## int uid, error, flag; + int ingerr(); + IIseterr(ingerr); ## ingres sms if (argc == 2) { @@ -82,3 +90,29 @@ char **argv; fix_file(outf); exit(SMS_SUCCESS); } + + +/* + * ingerr: (supposedly) called when Ingres indicates an error. + * I have not yet been able to get this to work to intercept a + * database open error. + */ +#define INGRES_DEADLOCK 4700 + +static int ingerr(num) + int *num; +{ + char buf[256]; + int ingres_errno; + + switch (*num) { + case INGRES_DEADLOCK: + ingres_errno = SMS_DEADLOCK; + break; + default: + ingres_errno = SMS_INGRES_ERR; + } + com_err(whoami, SMS_INGRES_ERR, " code %d\n", *num); + critical_alert("DCM", "Passwd build encountered INGRES ERROR %d", *num); + exit(ingres_errno); +}