Changeset 4488:13eb2a20987a in roaraudio for libroar/authfile.c
- Timestamp:
- 10/12/10 03:48:37 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/authfile.c
r4485 r4488 187 187 } 188 188 189 int roar_authfile_add_key(struct roar_authfile * authfile, struct roar_authfile_key * key); 189 int roar_authfile_add_key(struct roar_authfile * authfile, struct roar_authfile_key * key) { 190 if ( authfile == NULL || key == NULL ) 191 return -1; 192 193 switch (authfile->type) { 194 case ROAR_AUTHFILE_TYPE_ESD: 195 case ROAR_AUTHFILE_TYPE_PULSE: 196 if ( key->type != ROAR_AUTH_T_COOKIE || (key->index != 0 && key->index != -1) ) 197 return -1; 198 if ( roar_authfile_sync(authfile) == -1 ) 199 return -1; 200 if ( roar_authfile_lock(authfile) == -1 ) 201 return -1; 202 if ( roar_vio_lseek(&(authfile->vio), 0, SEEK_SET) != 0 ) 203 return -1; 204 if ( roar_vio_write(&(authfile->vio), key->data, key->len) != key->len ) 205 return -1; 206 if ( roar_authfile_unlock(authfile) == -1 ) 207 return -1; 208 return 0; 209 break; 210 default: 211 return -1; 212 break; 213 } 214 } 190 215 191 216 struct roar_authfile_key * roar_authfile_lookup_key(struct roar_authfile * authfile,
Note: See TracChangeset
for help on using the changeset viewer.