Print this page
293 useradd/del/mod should be ZFS-aware

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/oamuser/user/movedir.c
          +++ new/usr/src/cmd/oamuser/user/movedir.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22  
  23   23  /*
  24   24   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25   25   * Use is subject to license terms.
  26   26   */
  27   27  
  28   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   29  /*        All Rights Reserved   */
  30   30  
  31   31  
  32      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  33      -
  34   32  #include <sys/types.h>
  35   33  #include <stdio.h>
  36   34  #include <userdefs.h>
  37   35  #include "messages.h"
  38   36  #include <unistd.h>
  39   37  #include <sys/stat.h>
  40   38  #include <utime.h>
  41   39  
  42   40  #define SBUFSZ  256
  43   41  
  44   42  extern int access(), rm_files();
  45   43  
  46   44  static char cmdbuf[SBUFSZ];     /* buffer for system call */
  47   45  
  48   46  /*
  49   47   *      Move directory contents from one place to another
  50   48   */
  51   49  int
  52      -move_dir(char *from, char *to, char *login)
       50 +move_dir(char *from, char *to, char *login, int flags)
  53   51                  /* directory to move files from */
  54   52                  /* dirctory to move files to */
  55   53                  /* login id of owner */
       54 +                /* miscellaneous flags */
  56   55  {
  57   56          size_t len = 0;
  58   57          int rc = EX_SUCCESS;
  59   58          struct stat statbuf;
  60   59          struct utimbuf times;
  61   60          /*
  62   61           * ***** THIS IS WHERE SUFFICIENT SPACE CHECK GOES
  63   62           */
  64   63  
  65   64          if (access(from, F_OK) == 0) {  /* home dir exists */
↓ open down ↓ 19 lines elided ↑ open up ↑
  85   84                  /* Retain the original permission and modification time */
  86   85                  if (stat(from, &statbuf) == 0) {
  87   86                          chmod(to, statbuf.st_mode);
  88   87                          times.actime = statbuf.st_atime;
  89   88                          times.modtime = statbuf.st_mtime;
  90   89                          (void) utime(to, &times);
  91   90  
  92   91                  }
  93   92  
  94   93                  /* Remove the files in the old place */
  95      -                rc = rm_files(from, login);
       94 +                rc = rm_files(from, login, flags);
  96   95  
  97   96          }
  98   97  
  99   98          return (rc);
 100   99  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX