The Samba-Bugzilla – Attachment 1737 Details for
Bug 3522
CreateDirectory of a path name that exists on a Samba server (as a simple file) fails with wrong code/message.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Program (source) that creates a directory and reports error code
sambatest.cpp (text/plain), 1.92 KB, created by
Sandeep Tamhankar
on 2006-02-17 17:58:21 UTC
(
hide
)
Description:
Program (source) that creates a directory and reports error code
Filename:
MIME Type:
Creator:
Sandeep Tamhankar
Created:
2006-02-17 17:58:21 UTC
Size:
1.92 KB
patch
obsolete
>// sambatest.cpp -- >// >// This file implements a test case for the Samba CreateDirectory bug. >// >// Copyright (c) 2006 Electric Cloud, Inc. >// All rights reserved > >#include <windows.h> >#include <iostream> > >using namespace std; > >char *getErrorMessage( > bool verbose) // Return a verbose error message. >{ > const int BUFFER_SIZE = 500; > static char buffer[BUFFER_SIZE]; > int lastIndex, code; > > code = GetLastError(); >// if (code == 0) { >// // This is a bit of a kludge. For some reason, socket errors >// // are recorded separately from system call errors. If there >// // is no system call error pending, assume that the problem was >// // actually in the socket system. > >// code = WSAGetLastError(); >// } > if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, code, > MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, > BUFFER_SIZE, NULL) == 0) { > sprintf(buffer, "??"); > } > lastIndex = strlen(buffer) - 1; > if (buffer[lastIndex] == '\n') { > // Get rid of any trailing newline character or CRLF sequence; > // it just makes our printouts ugly. > > --lastIndex; > if (buffer[lastIndex] == '\r') { > --lastIndex; > } > } > if (buffer[lastIndex] == '.') { > // Get rid of a trailing period also, since it messes up our > // output. > > --lastIndex; > } > > if (verbose) { > // Add the numerical error code to the end of the message. > sprintf(buffer + lastIndex + 1, " (error code %d)", code); > } else { > buffer[lastIndex + 1] = 0; > } > return buffer; >} > >int main(int argc, char* argv[]) >{ > if (argc != 2) { > cout << "Usage: " << argv[0] << " dirName" << endl; > return 2; > } > > if (CreateDirectory(argv[1], 0)) { > cout << "No error" << endl; > } else { > cout << getErrorMessage(true) << endl; > } > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3522
: 1737 |
1738
|
1739