]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-cbd-20071205
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 5 Dec 2007 20:35:10 +0000 (20:35 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 5 Dec 2007 20:35:10 +0000 (20:35 +0000)
LICENSE IPL10

Windows requires open() to be called with O_BINARY otherwise Ctrl-Z
means EOF which breaks dumpfile processing.

Be consistent about writing/reading time as afs_uint32 instead of
writing as afs_uint32 and reading as time_t since time_t can be 32-bit
or 64-bit depending on the platform.

(cherry picked from commit 946f416577914aef5b31e398994fb8876b4ee5e9)

src/viced/callback.c

index 57e154a649461b0832c4ba336e750b5d689b223a..a16457cc500b365c2d44788f60bbc4187e54ba29 100644 (file)
@@ -1793,11 +1793,14 @@ PrintCallBackStats(void)
 int
 DumpCallBackState(void)
 {
-    int fd;
+    int fd, oflag;
     afs_uint32 magic = MAGIC, now = FT_ApproxTime(), freelisthead;
 
-    fd = open(AFSDIR_SERVER_CBKDUMP_FILEPATH, O_WRONLY | O_CREAT | O_TRUNC,
-             0666);
+    oflag = O_WRONLY | O_CREAT | O_TRUNC;
+#ifdef AFS_NT40_ENV
+    oflag |= O_BINARY;
+#endif
+    fd = open(AFSDIR_SERVER_CBKDUMP_FILEPATH, oflag, 0666);
     if (fd < 0) {
        ViceLog(0,
                ("Couldn't create callback dump file %s\n",
@@ -1831,11 +1834,15 @@ DumpCallBackState(void)
 time_t
 ReadDump(char *file)
 {
-    int fd;
+    int fd, oflag;
     afs_uint32 magic, freelisthead;
-    time_t now;
+    afs_uint32 now;
 
-    fd = open(file, O_RDONLY);
+    oflag = O_RDONLY;
+#ifdef AFS_NT40_ENV
+    oflag |= O_BINARY;
+#endif
+    fd = open(file, oflag);
     if (fd < 0) {
        fprintf(stderr, "Couldn't read dump file %s\n", file);
        exit(1);