misc.c (92555) | misc.c (98937) |
---|---|
1/* 2 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 138 unchanged lines hidden (view full) --- 147 struct passwd *copy = xmalloc(sizeof(*copy)); 148 149 memset(copy, 0, sizeof(*copy)); 150 copy->pw_name = xstrdup(pw->pw_name); 151 copy->pw_passwd = xstrdup(pw->pw_passwd); 152 copy->pw_gecos = xstrdup(pw->pw_gecos); 153 copy->pw_uid = pw->pw_uid; 154 copy->pw_gid = pw->pw_gid; | 1/* 2 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 138 unchanged lines hidden (view full) --- 147 struct passwd *copy = xmalloc(sizeof(*copy)); 148 149 memset(copy, 0, sizeof(*copy)); 150 copy->pw_name = xstrdup(pw->pw_name); 151 copy->pw_passwd = xstrdup(pw->pw_passwd); 152 copy->pw_gecos = xstrdup(pw->pw_gecos); 153 copy->pw_uid = pw->pw_uid; 154 copy->pw_gid = pw->pw_gid; |
155#ifdef HAVE_PW_EXPIRE_IN_PASSWD |
|
155 copy->pw_expire = pw->pw_expire; | 156 copy->pw_expire = pw->pw_expire; |
157#endif 158#ifdef HAVE_PW_CHANGE_IN_PASSWD |
|
156 copy->pw_change = pw->pw_change; | 159 copy->pw_change = pw->pw_change; |
160#endif 161#ifdef HAVE_PW_CLASS_IN_PASSWD |
|
157 copy->pw_class = xstrdup(pw->pw_class); | 162 copy->pw_class = xstrdup(pw->pw_class); |
163#endif |
|
158 copy->pw_dir = xstrdup(pw->pw_dir); 159 copy->pw_shell = xstrdup(pw->pw_shell); 160 return copy; 161} 162 163/* 164 * Convert ASCII string to TCP/IP port number. 165 * Port must be >0 and <=65535. --- 146 unchanged lines hidden (view full) --- 312 args->num = 0; 313 } else if (args->num+2 >= args->nalloc) 314 args->nalloc *= 2; 315 316 args->list = xrealloc(args->list, args->nalloc * sizeof(char *)); 317 args->list[args->num++] = xstrdup(buf); 318 args->list[args->num] = NULL; 319} | 164 copy->pw_dir = xstrdup(pw->pw_dir); 165 copy->pw_shell = xstrdup(pw->pw_shell); 166 return copy; 167} 168 169/* 170 * Convert ASCII string to TCP/IP port number. 171 * Port must be >0 and <=65535. --- 146 unchanged lines hidden (view full) --- 318 args->num = 0; 319 } else if (args->num+2 >= args->nalloc) 320 args->nalloc *= 2; 321 322 args->list = xrealloc(args->list, args->nalloc * sizeof(char *)); 323 args->list[args->num++] = xstrdup(buf); 324 args->list[args->num] = NULL; 325} |
326 327mysig_t 328mysignal(int sig, mysig_t act) 329{ 330#ifdef HAVE_SIGACTION 331 struct sigaction sa, osa; 332 333 if (sigaction(sig, NULL, &osa) == -1) 334 return (mysig_t) -1; 335 if (osa.sa_handler != act) { 336 memset(&sa, 0, sizeof(sa)); 337 sigemptyset(&sa.sa_mask); 338 sa.sa_flags = 0; 339#if defined(SA_INTERRUPT) 340 if (sig == SIGALRM) 341 sa.sa_flags |= SA_INTERRUPT; 342#endif 343 sa.sa_handler = act; 344 if (sigaction(sig, &sa, NULL) == -1) 345 return (mysig_t) -1; 346 } 347 return (osa.sa_handler); 348#else 349 return (signal(sig, act)); 350#endif 351} |
|