BSD 3 development
[unix-history] / usr / src / cmd / uucp / gnxseq.c
index 6f18b2c..27d5eb1 100644 (file)
 gnxseq(rmtname)
 char *rmtname;
 {
 gnxseq(rmtname)
 char *rmtname;
 {
-       int count = 0, ct, ret;
+       int count = 0, ct, ret, i;
        struct tm *tp;
        extern struct tm *localtime();
        time_t clock;
        FILE *fp0, *fp1;
        char buf[BUFSIZ], name[NAMESIZE];
 
        struct tm *tp;
        extern struct tm *localtime();
        time_t clock;
        FILE *fp0, *fp1;
        char buf[BUFSIZ], name[NAMESIZE];
 
-       if (ulockf(SQLOCK, SQTIME) != 0)
+       for (i = 0; i < 5; i++) {
+               if ((ret = ulockf(SQLOCK, SQTIME)) == 0)
+                       break;
+               sleep(5);
+       }
+       if (ret != 0) {
+               logent("CAN'T LOCK", SQLOCK);
+               DEBUG(4, "can't lock %s\n", SQLOCK);
                return(0);
                return(0);
+       }
        if ((fp0 = fopen(SQFILE, "r")) == NULL)
                return(0);
        if ((fp1 = fopen(SQTMP, "w")) == NULL) {
        if ((fp0 = fopen(SQFILE, "r")) == NULL)
                return(0);
        if ((fp1 = fopen(SQTMP, "w")) == NULL) {