| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| From what I understand, since 10.4 Finder uses the kqueue mechanism to keep the graphics in sync with files on disk. This works very well most of the time but I have encountered circumstances where it is not working. What I try to do is to lock and thereafter unlock a file. In my particular case I end up with a file which is unlocked but where the icon have a lock symbol in the lower left corner. Below is the source code for a simple command-line utility which reproduces the bug. (The call to sleep() is needed for the bug to occur and is put there to simulate some work.) Has anyone had a similar problem? What are the best (i.e. simplest) work-arounds? / Joakim Nyström #include <iostream> #include <sys/stat.h> #include <errno.h> #include <fcntl.h> int main(int argc, char* argv[]) { int result = 0; if (argc != 2) { std::cerr << "Exactely one filename must be specified" << std::endl; exit(1); } std::cout << "Creating file '" << argv[1] << "'" << std::endl; int fd = ::open(argv[1], O_CREAT); if (fd == -1) { std::cerr << "open failed" << std::endl; exit(2); } ::close(fd); //::sleep(10); // lock std::cout << "locking file" << std::endl; result = ::chflags(argv[1], UF_IMMUTABLE); if (result != 0) { std::cerr << "chflags failed (" << errno << ")" << std::endl; exit(3); } ::sleep(1); //unlock std::cout << "unlocking file" << std::endl; result = ::chflags(argv[1], 0); if (result != 0) { std::cerr << "chflags failed (" << errno << ")" << std::endl; exit(4); }
return 0; } (I have also reported this to radar as #4380992) -- Joakim Nyström Developer Propellerhead Software |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.