Print this page
195 Need replacement for nfs/lockd+klm
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Jeremy Jones <jeremy@delphix.com>
Reviewed by: Jeff Biseda <jbiseda@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/statd/sm_statd.c
          +++ new/usr/src/cmd/fs.d/nfs/statd/sm_statd.c
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29  /*
  30   30   * University Copyright- Copyright (c) 1982, 1986, 1988
  31   31   * The Regents of the University of California
  32   32   * All Rights Reserved
  33   33   *
  34   34   * University Acknowledgment- Portions of this document are derived from
  35   35   * software developed by the University of California, Berkeley, and its
  36   36   * contributors.
  37   37   */
  38   38  
  39      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       39 +/*
       40 + * Copyright (c) 2012 by Delphix. All rights reserved.
       41 + */
  40   42  
  41   43  /*
  42   44   * sm_statd.c consists of routines used for the intermediate
  43   45   * statd implementation(3.2 rpc.statd);
  44   46   * it creates an entry in "current" directory for each site that it monitors;
  45   47   * after crash and recovery, it moves all entries in "current"
  46   48   * to "backup" directory, and notifies the corresponding statd of its recovery.
  47   49   */
  48   50  
  49   51  #include <stdio.h>
↓ open down ↓ 73 lines elided ↑ open up ↑
 123  125                          (void) printf("empty file\n");
 124  126                  LOCAL_STATE = 0;
 125  127          }
 126  128  
 127  129          /*
 128  130           * Scan alternate paths for largest "state" number
 129  131           */
 130  132          for (i = 0; i < pathix; i++) {
 131  133                  (void) sprintf(state_file, "%s/statmon/state", path_name[i]);
 132  134                  if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) {
 133      -                        if ((fp_tmp = fopen(state_file, "w+"))
 134      -                                == (FILE *)NULL) {
      135 +                        if ((fp_tmp = fopen(state_file, "w+")) ==
      136 +                            (FILE *)NULL) {
 135  137                                  if (debug)
 136      -                                    syslog(LOG_ERR,
 137      -                                        "can't open %s: %m",
 138      -                                        state_file);
      138 +                                        syslog(LOG_ERR,
      139 +                                            "can't open %s: %m",
      140 +                                            state_file);
 139  141                                  continue;
 140  142                          } else
 141  143                                  (void) chmod(state_file, 0644);
 142  144                  }
 143  145                  if ((fscanf(fp_tmp, "%d", &tmp_state)) == EOF) {
 144  146                          if (debug)
 145      -                            syslog(LOG_ERR,
 146      -                                "statd: %s: file empty\n", state_file);
      147 +                                syslog(LOG_ERR,
      148 +                                    "statd: %s: file empty\n", state_file);
 147  149                          (void) fclose(fp_tmp);
 148  150                          continue;
 149  151                  }
 150  152                  if (tmp_state > LOCAL_STATE) {
 151  153                          LOCAL_STATE = tmp_state;
 152  154                          if (debug)
 153  155                                  (void) printf("Update LOCAL STATE: %d\n",
 154      -                                                tmp_state);
      156 +                                    tmp_state);
 155  157                  }
 156  158                  (void) fclose(fp_tmp);
 157  159          }
 158  160  
 159  161          LOCAL_STATE = ((LOCAL_STATE%2) == 0) ? LOCAL_STATE+1 : LOCAL_STATE+2;
 160  162  
 161  163          /* IF local state overflows, reset to value 1 */
 162  164          if (LOCAL_STATE < 0) {
 163  165                  LOCAL_STATE = 1;
 164  166          }
↓ open down ↓ 8 lines elided ↑ open up ↑
 173  175          (void) fflush(fp);
 174  176          if (fsync(fileno(fp)) == -1) {
 175  177                  syslog(LOG_ERR, "statd: fsync failed\n");
 176  178                  exit(1);
 177  179          }
 178  180          (void) fclose(fp);
 179  181  
 180  182          for (i = 0; i < pathix; i++) {
 181  183                  (void) sprintf(state_file, "%s/statmon/state", path_name[i]);
 182  184                  if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) {
 183      -                        if ((fp_tmp = fopen(state_file, "w+"))
 184      -                                == (FILE *)NULL) {
      185 +                        if ((fp_tmp = fopen(state_file, "w+")) ==
      186 +                            (FILE *)NULL) {
 185  187                                  syslog(LOG_ERR,
 186  188                                      "can't open %s: %m", state_file);
 187  189                                  continue;
 188  190                          } else
 189  191                                  (void) chmod(state_file, 0644);
 190  192                  }
 191  193                  (void) fprintf(fp_tmp, "%-10d", LOCAL_STATE);
 192  194                  (void) fflush(fp_tmp);
 193  195                  if (fsync(fileno(fp_tmp)) == -1) {
 194  196                          syslog(LOG_ERR,
↓ open down ↓ 21 lines elided ↑ open up ↑
 216  218          }
 217  219  
 218  220          /* get all entries in CURRENT into BACKUP */
 219  221          if ((dp = opendir(CURRENT)) == (DIR *)NULL) {
 220  222                  syslog(LOG_ERR, "statd: open current directory, error %m\n");
 221  223                  exit(1);
 222  224          }
 223  225  
 224  226          while ((dirp = readdir(dp)) != NULL) {
 225  227                  if (strcmp(dirp->d_name, ".") != 0 &&
 226      -                        strcmp(dirp->d_name, "..") != 0) {
 227      -                /* rename all entries from CURRENT to BACKUP */
      228 +                    strcmp(dirp->d_name, "..") != 0) {
      229 +                        /* rename all entries from CURRENT to BACKUP */
 228  230                          (void) move_file(CURRENT, dirp->d_name, BACKUP);
 229  231                  }
 230  232          }
 231  233  
 232  234          (void) closedir(dp);
 233  235  
 234  236          /* Contact hosts' statd */
 235  237          if (thr_create(NULL, NULL, thr_statd_init, NULL, THR_DETACHED, 0)) {
 236  238                  syslog(LOG_ERR,
 237  239                  "statd: unable to create thread for thr_statd_init\n");
↓ open down ↓ 52 lines elided ↑ open up ↑
 290  292                          num_threads -= num_join;
 291  293                  }
 292  294  
 293  295                  /*
 294  296                   * If can't alloc name then print error msg and
 295  297                   * continue to next item on list.
 296  298                   */
 297  299                  name = strdup(dirp->d_name);
 298  300                  if (name == (char *)NULL) {
 299  301                          syslog(LOG_ERR,
 300      -                                "statd: unable to allocate space for name %s\n",
 301      -                                dirp->d_name);
      302 +                            "statd: unable to allocate space for name %s\n",
      303 +                            dirp->d_name);
 302  304                          continue;
 303  305                  }
 304  306  
 305  307                  /* Create a thread to do a statd_call_statd for name */
 306  308                  if (thr_create(NULL, NULL, thr_call_statd,
 307      -                                        (void *) name, 0, 0)) {
      309 +                    (void *) name, 0, 0)) {
 308  310                          syslog(LOG_ERR,
 309      -                "statd: unable to create thr_call_statd() for name %s.\n",
 310      -                                dirp->d_name);
      311 +                            "statd: unable to create thr_call_statd() "
      312 +                            "for name %s.\n", dirp->d_name);
 311  313                          free(name);
 312  314                          continue;
 313  315                  }
 314  316                  num_threads++;
 315  317          }
 316  318  
 317  319          /*
 318  320           * Join the other threads created above before processing the
 319  321           * legacies.  This allows all symlinks and the regular files
 320  322           * to which they correspond to be processed and deleted.
↓ open down ↓ 6 lines elided ↑ open up ↑
 327  329           * The second pass checks for `legacies':  regular files which
 328  330           * never had symlinks pointing to them at all, just like in the
 329  331           * good old (pre-1184192 fix) days.  Once a machine has cleaned
 330  332           * up its legacies they should only reoccur due to catastrophes
 331  333           * (e.g., severed symlinks).
 332  334           */
 333  335          rewinddir(dp);
 334  336          num_threads = 0;
 335  337          while ((dirp = readdir(dp)) != NULL) {
 336  338                  if (strcmp(dirp->d_name, ".") == 0 ||
 337      -                        strcmp(dirp->d_name, "..") == 0) {
      339 +                    strcmp(dirp->d_name, "..") == 0) {
 338  340                          continue;
 339  341                  }
 340  342  
 341  343                  (void) sprintf(buf, "%s/%s", BACKUP, dirp->d_name);
 342  344                  if (is_symlink(buf)) {
 343  345                          /*
 344  346                           * We probably couldn't reach this host and it's
 345  347                           * been put on the recovery queue for retry.
 346  348                           * Skip it and keep looking for regular files.
 347  349                           */
 348  350                          continue;
 349  351                  }
 350  352  
 351  353                  if (debug) {
 352  354                          (void) printf("thr_statd_init: legacy %s\n",
 353      -                                        dirp->d_name);
      355 +                            dirp->d_name);
 354  356                  }
 355  357  
 356  358                  /*
 357  359                   * If the number of threads exceeds the maximum, wait
 358  360                   * for some fraction of them to finish before
 359  361                   * continuing.
 360  362                   */
 361  363                  if (num_threads > MAX_THR) {
 362  364                          num_join = num_threads/PERCENT_MINJOIN;
 363  365                          for (i = 0; i < num_join; i++)
↓ open down ↓ 1 lines elided ↑ open up ↑
 365  367                          num_threads -= num_join;
 366  368                  }
 367  369  
 368  370                  /*
 369  371                   * If can't alloc name then print error msg and
 370  372                   * continue to next item on list.
 371  373                   */
 372  374                  name = strdup(dirp->d_name);
 373  375                  if (name == (char *)NULL) {
 374  376                          syslog(LOG_ERR,
 375      -                        "statd: unable to allocate space for name %s\n",
 376      -                                dirp->d_name);
      377 +                            "statd: unable to allocate space for name %s\n",
      378 +                            dirp->d_name);
 377  379                          continue;
 378  380                  }
 379  381  
 380  382                  /* Create a thread to do a statd_call_statd for name */
 381  383                  if (thr_create(NULL, NULL, thr_call_statd,
 382      -                                        (void *) name, 0, 0)) {
      384 +                    (void *) name, 0, 0)) {
 383  385                          syslog(LOG_ERR,
 384      -                "statd: unable to create thr_call_statd() for name %s.\n",
 385      -                                dirp->d_name);
      386 +                            "statd: unable to create thr_call_statd() "
      387 +                            "for name %s.\n", dirp->d_name);
 386  388                          free(name);
 387  389                          continue;
 388  390                  }
 389  391                  num_threads++;
 390  392          }
 391  393  
 392  394          (void) closedir(dp);
 393  395  
 394  396          /*
 395  397           * Join the other threads created above before creating thread
↓ open down ↓ 7 lines elided ↑ open up ↑
 403  405           * Need to only copy /var/statmon/sm.bak to alternate paths, since
 404  406           * the only hosts in /var/statmon/sm should be the ones currently
 405  407           * being monitored and already should be in alternate paths as part
 406  408           * of insert_mon().
 407  409           */
 408  410          for (i = 0; i < pathix; i++) {
 409  411                  (void) sprintf(buf, "%s/statmon/sm.bak", path_name[i]);
 410  412                  if ((mkdir(buf, SM_DIRECTORY_MODE)) == -1) {
 411  413                          if (errno != EEXIST)
 412  414                                  syslog(LOG_ERR, "statd: mkdir %s error %m\n",
 413      -                                        buf);
      415 +                                    buf);
 414  416                          else
 415  417                                  copydir_from_to(BACKUP, buf);
 416  418                  } else
 417  419                          copydir_from_to(BACKUP, buf);
 418  420          }
 419  421  
 420  422  
 421  423          /*
 422  424           * Reset the die and in_crash variable and signal other threads
 423  425           * that have issued an sm_crash and are waiting.
↓ open down ↓ 3 lines elided ↑ open up ↑
 427  429          in_crash = 0;
 428  430          mutex_unlock(&crash_lock);
 429  431          cond_broadcast(&crash_finish);
 430  432  
 431  433          if (debug)
 432  434                  (void) printf("Creating thread for sm_try\n");
 433  435  
 434  436          /* Continue to notify statd on hosts that were unreachable. */
 435  437          if (thr_create(NULL, NULL, sm_try, NULL, THR_DETACHED, 0))
 436  438                  syslog(LOG_ERR,
 437      -                        "statd: unable to create thread for sm_try().\n");
      439 +                    "statd: unable to create thread for sm_try().\n");
 438  440          thr_exit((void *) 0);
 439  441  #ifdef lint
 440  442          return (0);
 441  443  #endif
 442  444  }
 443  445  
 444  446  /*
 445  447   * Work thread to make call to statd_call_statd.
 446  448   */
 447  449  void *
↓ open down ↓ 34 lines elided ↑ open up ↑
 482  484                   * as regular file) needlessly, usually on separate reboots.
 483  485                   */
 484  486                  (void) strcpy(path, BACKUP);
 485  487                  (void) strcat(path, "/");
 486  488                  (void) strcat(path, name);
 487  489                  if (is_symlink(path)) {
 488  490                          n = readlink(path, rname, MAXNAMELEN);
 489  491                          if (n <= 0) {
 490  492                                  if (debug >= 2) {
 491  493                                          (void) printf(
 492      -                                        "thr_call_statd: can't read link %s\n",
 493      -                                                        path);
      494 +                                            "thr_call_statd: can't read "
      495 +                                            "link %s\n", path);
 494  496                                  }
 495  497                          } else {
 496  498                                  rname[n] = '\0';
 497  499  
 498  500                                  tail = strrchr(path, '/') + 1;
 499  501  
 500  502                                  if ((strlen(BACKUP) + strlen(rname) + 2) <=
 501  503                                      MAXPATHLEN) {
 502  504                                          (void) strcpy(tail, rname);
 503  505                                          delete_file(path);
↓ open down ↓ 70 lines elided ↑ open up ↑
 574  576           * This may change in a future release.
 575  577           */
 576  578          if (debug) {
 577  579                  (void) printf("statd_call_statd: calling create_client(%s)\n",
 578  580                                  name_or_addr);
 579  581          }
 580  582  
 581  583          tottimeout.tv_sec = SM_RPC_TIMEOUT;
 582  584          tottimeout.tv_usec = 0;
 583  585  
 584      -        if ((clnt = create_client(name_or_addr, SM_PROG, SM_VERS,
 585      -            &tottimeout)) == (CLIENT *) NULL) {
      586 +        if ((clnt = create_client(name_or_addr, SM_PROG, SM_VERS, NULL,
      587 +            &tottimeout)) == NULL) {
 586  588                  return (-1);
 587  589          }
 588  590  
 589  591          /* Perform notification to client */
 590  592          rc = 0;
 591  593          clnt_stat = clnt_call(clnt, SM_NOTIFY, xdr_stat_chge, (char *)&ntf,
 592  594              xdr_void, NULL, tottimeout);
 593  595          if (debug) {
 594  596                  (void) printf("clnt_stat=%s(%d)\n",
 595  597                          clnt_sperrno(clnt_stat), clnt_stat);
↓ open down ↓ 72 lines elided ↑ open up ↑
 668  670                                  /* remove entry from recovery_q */
 669  671                                  delete_name(&recov_q.sm_recovhdp, nl->name);
 670  672                                  mutex_unlock(&recov_q.lock);
 671  673                          } else {
 672  674                                  /*
 673  675                                   * Print message only once since unreachable
 674  676                                   * host can be contacted forever.
 675  677                                   */
 676  678                                  if (delay == 0)
 677  679                                          syslog(LOG_WARNING,
 678      -                                        "statd: host %s is not responding\n",
 679      -                                                nl->name);
      680 +                                            "statd: host %s is not "
      681 +                                            "responding\n", nl->name);
 680  682                          }
 681  683                  }
 682  684                  /*
 683  685                   * Increment the amount of delay before restarting again.
 684  686                   * The amount of delay should not exceed the MAX_DELAYTIME.
 685  687                   */
 686  688                  if (delay <= MAX_DELAYTIME)
 687  689                          delay += INC_DELAYTIME;
 688  690                  mutex_lock(&crash_lock);
 689  691          }
↓ open down ↓ 338 lines elided ↑ open up ↑
1028 1030   * dir1, depending on whether dir2 is NULL.
1029 1031   */
1030 1032  static void
1031 1033  remove_single_name(char *name, char *dir1, char *dir2)
1032 1034  {
1033 1035          int n, error;
1034 1036          char path[MAXPATHLEN+MAXNAMELEN+SM_MAXPATHLEN]; /* why > MAXPATHLEN? */
1035 1037          char dirpath[MAXPATHLEN];
1036 1038          char rname[MAXNAMELEN + 1]; /* +1 for NULL term */
1037 1039  
1038      -        if (strlen(name) + strlen(dir1) + (dir2 != NULL ? strlen(dir2) : 0)
1039      -                        + 3 > MAXPATHLEN) {
     1040 +        if (strlen(name) + strlen(dir1) + (dir2 != NULL ? strlen(dir2) : 0) +
     1041 +            3 > MAXPATHLEN) {
1040 1042                  if (dir2 != NULL)
1041 1043                          syslog(LOG_ERR,
1042      -                                "statd: pathname too long: %s/%s/%s\n",
1043      -                                                dir1, dir2, name);
     1044 +                            "statd: pathname too long: %s/%s/%s\n",
     1045 +                            dir1, dir2, name);
1044 1046                  else
1045 1047                          syslog(LOG_ERR,
1046      -                                "statd: pathname too long: %s/%s\n",
1047      -                                                dir1, name);
     1048 +                            "statd: pathname too long: %s/%s\n",
     1049 +                            dir1, name);
1048 1050  
1049 1051                  return;
1050 1052          }
1051 1053  
1052 1054          (void) strcpy(path, dir1);
1053 1055          (void) strcat(path, "/");
1054 1056          if (dir2 != NULL) {
1055 1057                  (void) strcat(path, dir2);
1056 1058                  (void) strcat(path, "/");
1057 1059          }
↓ open down ↓ 13 lines elided ↑ open up ↑
1071 1073                          if (count_symlinks(dirpath, rname, &n) < 0) {
1072 1074                                  return;
1073 1075                          }
1074 1076  
1075 1077                          if (n == 1) {
1076 1078                                  (void) strcat(dirpath, rname);
1077 1079                                  error = unlink(dirpath);
1078 1080                                  if (debug >= 2) {
1079 1081                                          if (error < 0) {
1080 1082                                                  (void) printf(
1081      -                                        "remove_name: can't unlink %s\n",
1082      -                                                        dirpath);
     1083 +                                                    "remove_name: can't "
     1084 +                                                    "unlink %s\n",
     1085 +                                                    dirpath);
1083 1086                                          } else {
1084 1087                                                  (void) printf(
1085      -                                        "remove_name: unlinked %s\n",
1086      -                                                        dirpath);
     1088 +                                                    "remove_name: unlinked ",
     1089 +                                                    "%s\n", dirpath);
1087 1090                                          }
1088 1091                                  }
1089 1092                          }
1090 1093                  } else {
1091 1094                          /*
1092 1095                           * Policy: if we can't read the symlink, leave it
1093 1096                           * here for analysis by the system administrator.
1094 1097                           */
1095 1098                          syslog(LOG_ERR,
1096      -                                "statd: can't read link %s: %m\n", path);
     1099 +                            "statd: can't read link %s: %m\n", path);
1097 1100                  }
1098 1101          }
1099 1102  
1100 1103          /*
1101 1104           * If it's a regular file, we can assume all symlinks and the
1102 1105           * files to which they refer have been processed already - just
1103 1106           * fall through to here to remove it.
1104 1107           */
1105 1108          delete_file(path);
1106 1109  }
↓ open down ↓ 8 lines elided ↑ open up ↑
1115 1118  {
1116 1119          int cnt = 0;
1117 1120          int n;
1118 1121          DIR *dp;
1119 1122          struct dirent *dirp;
1120 1123          char lpath[MAXPATHLEN];
1121 1124          char rname[MAXNAMELEN + 1]; /* +1 for term NULL */
1122 1125  
1123 1126          if ((dp = opendir(dir)) == (DIR *)NULL) {
1124 1127                  syslog(LOG_ERR, "count_symlinks: open %s dir, error %m\n",
1125      -                        dir);
     1128 +                    dir);
1126 1129                  return (-1);
1127 1130          }
1128 1131  
1129 1132          while ((dirp = readdir(dp)) != NULL) {
1130 1133                  if (strcmp(dirp->d_name, ".") == 0 ||
1131      -                        strcmp(dirp->d_name, "..") == 0) {
     1134 +                    strcmp(dirp->d_name, "..") == 0) {
1132 1135                          continue;
1133 1136                  }
1134 1137  
1135 1138                  (void) sprintf(lpath, "%s%s", dir, dirp->d_name);
1136 1139                  if (is_symlink(lpath)) {
1137 1140                          /*
1138 1141                           * Fetch the name of the file the symlink refers to.
1139 1142                           */
1140 1143                          n = readlink(lpath, rname, MAXNAMELEN);
1141 1144                          if (n <= 0) {
1142 1145                                  if (debug >= 2) {
1143 1146                                          (void) printf(
1144      -                                        "count_symlinks: can't read link %s\n",
1145      -                                                lpath);
     1147 +                                            "count_symlinks: can't read link "
     1148 +                                            "%s\n", lpath);
1146 1149                                  }
1147 1150                                  continue;
1148 1151                          }
1149 1152                          rname[n] = '\0';
1150 1153  
1151 1154                          /*
1152 1155                           * If `rname' matches `name', bump the count.  There
1153 1156                           * may well be multiple symlinks to the same name, so
1154 1157                           * we must continue to process the entire directory.
1155 1158                           */
↓ open down ↓ 166 lines elided ↑ open up ↑
1322 1325                                  return;
1323 1326                          addr6 = (char *)ah->n_bytes;
1324 1327          } else
1325 1328                  return;
1326 1329  
1327 1330          if (debug) {
1328 1331                  if (family == AF_INET)
1329 1332                          (void) printf("record_addr: addr= %x\n", addr.s_addr);
1330 1333                  else if (family == AF_INET6)
1331 1334                          (void) printf("record_addr: addr= %x\n", \
1332      -                                ((struct in6_addr *)addr6)->s6_addr);
     1335 +                            ((struct in6_addr *)addr6)->s6_addr);
1333 1336          }
1334 1337  
1335 1338          if (family == AF_INET) {
1336 1339                  if (addr.s_addr == INADDR_ANY ||
1337 1340                      ((addr.s_addr && 0xff000000) == 0)) {
1338 1341                          syslog(LOG_DEBUG,
1339      -                                "record_addr: illegal IP address %x\n",
1340      -                                addr.s_addr);
     1342 +                            "record_addr: illegal IP address %x\n",
     1343 +                            addr.s_addr);
1341 1344                          return;
1342 1345                  }
1343 1346          }
1344 1347  
1345 1348          /* convert address to ASCII */
1346 1349          famstr = family2string(family);
1347 1350          if (famstr == NULL) {
1348 1351                  syslog(LOG_DEBUG,
1349      -                        "record_addr: unsupported address family %d\n",
1350      -                        family);
     1352 +                    "record_addr: unsupported address family %d\n",
     1353 +                    family);
1351 1354                  return;
1352 1355          }
1353 1356  
1354 1357          switch (family) {
1355 1358                  char abuf[INET6_ADDRSTRLEN];
1356      -            case AF_INET:
     1359 +        case AF_INET:
1357 1360                  (void) sprintf(ascii_addr, "%s.%s", famstr, inet_ntoa(addr));
1358 1361                  break;
1359 1362  
1360      -            case AF_INET6:
     1363 +        case AF_INET6:
1361 1364                  (void) sprintf(ascii_addr, "%s.%s", famstr,\
1362 1365                      inet_ntop(family, addr6, abuf, sizeof (abuf)));
1363 1366                  break;
1364 1367  
1365      -            default:
     1368 +        default:
1366 1369                  if (debug) {
1367 1370                          (void) printf(
1368      -                "record_addr: family2string supports unknown family %d (%s)\n",
1369      -                                family,
1370      -                                famstr);
     1371 +                            "record_addr: family2string supports unknown "
     1372 +                            "family %d (%s)\n", family, famstr);
1371 1373                  }
1372 1374                  free(famstr);
1373 1375                  return;
1374 1376          }
1375 1377  
1376 1378          if (debug) {
1377 1379                  (void) printf("record_addr: ascii_addr= %s\n", ascii_addr);
1378 1380          }
1379 1381          free(famstr);
1380 1382  
↓ open down ↓ 1 lines elided ↑ open up ↑
1382 1384           * Make the symlink in CURRENT.  The `name' file should have
1383 1385           * been created previously by record_name().
1384 1386           */
1385 1387          (void) create_symlink(CURRENT, name, ascii_addr);
1386 1388  
1387 1389          /*
1388 1390           * Similarly for alternate paths.
1389 1391           */
1390 1392          for (i = 0; i < pathix; i++) {
1391 1393                  path_len = strlen(path_name[i]) +
1392      -                                        strlen("/statmon/sm/") +
1393      -                                        strlen(name) + 1;
     1394 +                    strlen("/statmon/sm/") +
     1395 +                    strlen(name) + 1;
1394 1396  
1395 1397                  if (path_len > MAXPATHLEN) {
1396 1398                          syslog(LOG_ERR,
1397      -                                "statd: pathname too long: %s/statmon/sm/%s\n",
1398      -                                path_name[i], name);
     1399 +                            "statd: pathname too long: %s/statmon/sm/%s\n",
     1400 +                            path_name[i], name);
1399 1401                          continue;
1400 1402                  }
1401 1403                  (void) strcpy(path, path_name[i]);
1402 1404                  (void) strcat(path, "/statmon/sm");
1403 1405                  (void) create_symlink(path, name, ascii_addr);
1404 1406          }
1405 1407  }
1406 1408  
1407 1409  /*
1408 1410   * SM_CRASH - simulate a crash of statd.
↓ open down ↓ 146 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX