public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Bad file descriptor with fctnl
@ 1999-11-15  7:30 swansonm
  1999-11-30 23:28 ` swansonm
  0 siblings, 1 reply; 2+ messages in thread
From: swansonm @ 1999-11-15  7:30 UTC (permalink / raw)
  To: help-gcc

Hi,

I'm trying to make a covert channel program (secure way of transfering information)

for a class.

Basicly, it signals bits through watching file locks.

I call open( ) on three different files.

if ((f_rdy = open("/tmp/.rdy", O_CREAT | O_WRONLY | O_TRUNC,
                                S_IRWXO | S_IRWXG | S_IRWXU)) < 0) {
      perror(argv[0]);
      exit(2);
}



and I get back the file descriptors 6, 8, 10.

Then I use fcntl to set or check on file locks.  Yet I will get

the error message "bad file descriptor" on a few of the calls to fcntl()

      lock.l_type   = F_RDLCK;      // set a write lock
      lock.l_whence = 0;            // start at beginning
      lock.l_start  = 0L;
      lock.l_len    = 0L;           //whole file
      if (fcntl(f_rdy, F_SETLK, &lock) < 0 )
         perror("f_rdy set to rdlck by reader");

Does any one know what I"m doing wrong?  Please directly email to
swansonm@nospam.iastate.edu by removing the "nospam."  Thanks tons!

Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Bad file descriptor with fctnl
  1999-11-15  7:30 Bad file descriptor with fctnl swansonm
@ 1999-11-30 23:28 ` swansonm
  0 siblings, 0 replies; 2+ messages in thread
From: swansonm @ 1999-11-30 23:28 UTC (permalink / raw)
  To: help-gcc

Hi,

I'm trying to make a covert channel program (secure way of transfering information)

for a class.

Basicly, it signals bits through watching file locks.

I call open( ) on three different files.

if ((f_rdy = open("/tmp/.rdy", O_CREAT | O_WRONLY | O_TRUNC,
                                S_IRWXO | S_IRWXG | S_IRWXU)) < 0) {
      perror(argv[0]);
      exit(2);
}



and I get back the file descriptors 6, 8, 10.

Then I use fcntl to set or check on file locks.  Yet I will get

the error message "bad file descriptor" on a few of the calls to fcntl()

      lock.l_type   = F_RDLCK;      // set a write lock
      lock.l_whence = 0;            // start at beginning
      lock.l_start  = 0L;
      lock.l_len    = 0L;           //whole file
      if (fcntl(f_rdy, F_SETLK, &lock) < 0 )
         perror("f_rdy set to rdlck by reader");

Does any one know what I"m doing wrong?  Please directly email to
swansonm@nospam.iastate.edu by removing the "nospam."  Thanks tons!

Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-11-30 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-15  7:30 Bad file descriptor with fctnl swansonm
1999-11-30 23:28 ` swansonm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).