Advertisement
Guest User

Untitled

a guest
Jan 18th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2. #include<libcryptsetup.h>
  3. #include<stdio.h>
  4. #include<string.h>
  5.  
  6. int main( int argc,char * argv[] )
  7. {
  8. struct crypt_device * cd;
  9. const char * id ;
  10. const char * mapper = argv[1] ;
  11.  
  12. if( crypt_init_by_name( &cd,mapper ) < 0 ){
  13. perror( "crypt_init_by_name() failed" ) ;
  14. crypt_free( cd ) ;
  15. return 1 ;
  16. }
  17.  
  18. id = crypt_get_uuid( cd ) ;
  19.  
  20. if( id == NULL ){
  21. perror( "crypt_get_uuid() failed" ) ;
  22. crypt_free( cd ) ;
  23. return 1 ;
  24. }else{
  25. printf( "UUID=%s\n",id ) ;
  26. }
  27.  
  28. crypt_free( cd ) ;
  29. return 0 ;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement