Skip to content

Commit 5a58110

Browse files
committed
Cygwin: message queues are not devices
Message queues are basically just files and in most cases can be handled like normal files. So it was a mistake to set the "on-disk-device" flag for them to fix the mq_unlink() problem reported in https://cygwin.com/pipermail/cygwin/2025-January/257119.html Rather, given that unlink() just checks if the object to be deleted has an on-disk representation, make sure message queues are added to the path_conv::isondisk() predicate. This also reverts commit d870655. Fixes: d870655 ("Cygwin: path_conv: set on-disk-device flag for message queue files") Reported-by: Christian Franke <[email protected]> Signed-off-by: Corinna Vinschen <[email protected]> (cherry picked from commit b940faa)
1 parent cb23ca3 commit 5a58110

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

winsup/cygwin/local_includes/devices.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ class device : private _device
377377
}
378378
fh_devices operator = (fh_devices n) {return d.devn_fh_devices = n;}
379379
inline void setfs (bool x) {dev_on_fs = x;}
380-
inline bool isfs () const {return dev_on_fs || d.devn == FH_FS;}
380+
inline bool isfs () const {return dev_on_fs || d.devn == FH_FS
381+
|| d.devn == FH_MQUEUE;}
381382
inline bool is_fs_special () const {return dev_on_fs && d.devn != FH_FS;}
382383
inline bool is_dev_resident () const {return lives_in_dev;}
383384
inline int exists () const {return exists_func (*this);}

winsup/cygwin/local_includes/path.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ class path_conv
228228
/proc. */
229229
int isspecial () const {return dev.not_device (FH_FS);}
230230
/* Devices with representation on disk. This includes local sockets, FIFOs,
231-
message queues and devices created with mknod. It does not include
232-
the /proc hierarchy. */
231+
devices created with mknod. It does not include the /proc hierarchy. */
233232
int is_fs_special () const {return dev.is_fs_special ();}
234233
/* Like is_fs_special but excluding local sockets. */
235234
int is_lnk_special () const {return is_fs_special () && !issocket ();}

winsup/cygwin/path.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,10 +1233,7 @@ path_conv::check (const char *src, unsigned opt,
12331233

12341234
/* FIXME: bad hack alert!!! We need a better solution */
12351235
if (!strncmp (path_copy, MQ_PATH, MQ_LEN) && path_copy[MQ_LEN])
1236-
{
1237-
dev.parse (FH_MQUEUE);
1238-
dev.setfs (1);
1239-
}
1236+
dev.parse (FH_MQUEUE);
12401237
}
12411238

12421239
if (opt & PC_NOFULL)

winsup/cygwin/release/3.5.7

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fixes:
2+
------
3+
4+
- Fix stat() on message queues.
5+
Addresses: https://cygwin.com/pipermail/cygwin/2025-January/257186.html

0 commit comments

Comments
 (0)