Used O_EXCL|O_RDWR and fcntl() even within sg_obtain_scsi_adr()

This commit is contained in:
Thomas Schmitt 2007-04-10 08:20:45 +00:00
parent f617567e03
commit 159715ebaa
2 changed files with 8 additions and 3 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.04.10.081855"
#define Cdrskin_timestamP "2007.04.10.082229"

View File

@ -1149,7 +1149,7 @@ ex:;
int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no,
int *target_no, int *lun_no)
{
int fd, ret, l;
int fd, ret, l, open_mode = O_RDWR | O_NONBLOCK;
struct my_scsi_idlun {
int x;
int host_unique_id;
@ -1164,7 +1164,12 @@ int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no,
/* ts A70409 : DDLP */
/* >>> obtain single lock on path */
fd = open(path, O_RDONLY | O_NONBLOCK);
if(burn_sg_open_o_excl)
open_mode |= O_EXCL;
fd = open(path, open_mode);
if(fd < 0)
return 0;
sg_fcntl_lock(&fd, path);
if(fd < 0)
return 0;