summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-31 16:14:04 -0700
committerJeremy Allison <jra@samba.org>2011-06-01 02:54:51 +0200
commit1cee71713f75dbee653ea86bd4e7c87efe677cf6 (patch)
treed55d8051935077eda22d05a4078a7097b27d05ae /source3/printing
parent5abab13851ff2fc3a5792d08cc753c9b479c8cc1 (diff)
downloadsamba-1cee71713f75dbee653ea86bd4e7c87efe677cf6.tar.gz
samba-1cee71713f75dbee653ea86bd4e7c87efe677cf6.tar.bz2
samba-1cee71713f75dbee653ea86bd4e7c87efe677cf6.zip
Change sys_getcd() to take no arguments and always return malloc'ed memory (or NULL).
Part of the efforts to remove PATH_MAX on modern systems.
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/print_generic.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c
index b925bedace..14f4c6dbe7 100644
--- a/source3/printing/print_generic.c
+++ b/source3/printing/print_generic.c
@@ -155,17 +155,17 @@ static int generic_job_submit(int snum, struct printjob *pjob)
/* we print from the directory path to give the best chance of
parsing the lpq output */
- current_directory = TALLOC_ARRAY(ctx,
- char,
- PATH_MAX+1);
- if (!current_directory) {
- return -1;
- }
- wd = sys_getwd(current_directory);
+ wd = sys_getwd();
if (!wd) {
return -1;
}
+ current_directory = talloc_strdup(ctx, wd);
+ SAFE_FREE(wd);
+
+ if (!current_directory) {
+ return -1;
+ }
print_directory = talloc_strdup(ctx, pjob->filename);
if (!print_directory) {
return -1;
@@ -205,7 +205,7 @@ static int generic_job_submit(int snum, struct printjob *pjob)
out:
- if (chdir(wd) == -1) {
+ if (chdir(current_directory) == -1) {
smb_panic("chdir failed in generic_job_submit");
}
TALLOC_FREE(current_directory);