Raymond Toy pushed to branch issue-393-os-common-getpwuid at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/unix.lisp
    ... ... @@ -2413,16 +2413,10 @@
    2413 2413
       (dir "" :type string)
    
    2414 2414
       (shell "" :type string))
    
    2415 2415
     
    
    2416
    -;; See <pwd.h>
    
    2417
    -;;
    
    2418
    -;; While each OS may contain additional fields, we only need the ones
    
    2419
    -;; that are used the user-info structure.
    
    2420
    -;;
    
    2421
    -;; NOTE: This may NOT be the actual OS-defined passwd structure.  It
    
    2422
    -;; is the structure returned by os_getpwuid (in unix-getpwuid).
    
    2423
    -
    
    2416
    +;; The C structure that is returned by os_getpwuid containing the info
    
    2417
    +;; that we use to fill the user-info object.
    
    2424 2418
     (def-alien-type nil
    
    2425
    -    (struct unix-passwd
    
    2419
    +    (struct os-unix-info
    
    2426 2420
     	    (pw-name (* char))          ; user's login name
    
    2427 2421
     	    (pw-passwd (* char))        ; no longer used
    
    2428 2422
     	    (pw-uid uid-t)              ; user id
    

  • src/lisp/os-common.c
    ... ... @@ -950,7 +950,7 @@ os_get_user_homedir(const char* name, int *status)
    950 950
     /*
    
    951 951
      * This MUST match the definition in code/unix.lisp.
    
    952 952
      */
    
    953
    -struct unix_passwd 
    
    953
    +struct os_user_info
    
    954 954
     {
    
    955 955
         char* pw_name;
    
    956 956
         char* pw_passwd;
    
    ... ... @@ -961,7 +961,7 @@ struct unix_passwd
    961 961
         char* pw_shell;
    
    962 962
     };
    
    963 963
         
    
    964
    -struct unix_passwd*
    
    964
    +struct os_user_info*
    
    965 965
     os_getpwuid(uid_t uid)
    
    966 966
     {
    
    967 967
         char initial[1024];
    
    ... ... @@ -969,7 +969,7 @@ os_getpwuid(uid_t uid)
    969 969
         size_t size;
    
    970 970
         struct passwd pwd;
    
    971 971
         struct passwd *ppwd;
    
    972
    -    struct unix_passwd *result = NULL;
    
    972
    +    struct os_user_info *result = NULL;
    
    973 973
     
    
    974 974
         buffer = initial;
    
    975 975
         obuffer = NULL;
    
    ... ... @@ -988,7 +988,7 @@ again:
    988 988
     	   * that.
    
    989 989
     	   */
    
    990 990
     	  if (ppwd != NULL) {
    
    991
    -	      result = (struct unix_passwd*) malloc(sizeof(pwd));
    
    991
    +	      result = (struct os_user_info*) malloc(sizeof(*result));
    
    992 992
     	      result->pw_name = strdup(pwd.pw_name);
    
    993 993
     	      result->pw_passwd = strdup(pwd.pw_passwd);
    
    994 994
     	      result->pw_uid = pwd.pw_uid;
    
    ... ... @@ -1025,7 +1025,7 @@ again:
    1025 1025
      * os_getpwuid().
    
    1026 1026
      */
    
    1027 1027
     void
    
    1028
    -os_free_getpwuid(struct passwd* pwd)
    
    1028
    +os_free_getpwuid(struct os_user_info* pwd)
    
    1029 1029
     {
    
    1030 1030
         free(pwd->pw_name);
    
    1031 1031
         free(pwd->pw_passwd);